def test_it_notifies_a_function_call_in_the_current_thread(self):
        # Arrange
        call_handler = Mock()
        process_scoped_tracer = ProcessScopedTracer(call_handler)

        # Act
        process_scoped_tracer.start()
        function1()
        process_scoped_tracer.stop()

        # Assert
        assert_equal(call_handler.on_call.call_count, 1)
        assert_in('function1', [call[0][0].function_name for call in call_handler.on_call.call_args_list])
    def test_it_notifies_a_function_call_in_a_new_thread(self):
        # Arrange
        call_handler = Mock()
        process_scoped_tracer = ProcessScopedTracer(call_handler)

        # Act
        process_scoped_tracer.start()
        new_thread = threading.Thread(target=function1)
        new_thread.start()
        new_thread.join()
        process_scoped_tracer.stop()

        # Assert
        assert_in('function1', [call[0][0].function_name for call in call_handler.on_call.call_args_list])