def test_do_not_trace_non_deferred_returns(): """ If a function returns a non-Deferred value, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace(FakeFrame(), 'return', None) assert not t._function_data
def test_trace_deferred_return_initial_setup(): """ If a function returns a Deferred, nothing happens until the Deferred fires. More specifically, no function trace information is stored. """ t = Tracer() d = defer.Deferred() t._trace(_frame_spam, 'return', d) assert not t._function_data
def test_do_not_trace_defer_module(): """ If a function in twisted.internet.defer returns a Deferred, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace(FakeFrame(globals={'__name__': 'twisted.internet.defer'}), 'return', defer.Deferred()) assert not t._function_data
def test_do_not_trace_generators(): """ If a generator function returns a Deferred, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace(FakeFrame(FakeCode(flags=inspect.CO_GENERATOR)), 'return', defer.Deferred()) assert not t._function_data
def test_do_not_trace_defer_module(): """ If a function in twisted.internet.defer returns a Deferred, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace( FakeFrame(globals={'__name__': 'twisted.internet.defer'}), 'return', defer.Deferred()) assert not t._function_data
def test_do_not_trace_generators(): """ If a generator function returns a Deferred, nothing happens. More specifically, no function trace information is stored. """ t = Tracer() t._trace( FakeFrame(FakeCode(flags=inspect.CO_GENERATOR)), 'return', defer.Deferred()) assert not t._function_data
def test_tracer_wrapped_hook(fakesys): """ If a profile hook was set prior to calling Tracer's install method, it will continue to be called by Tracer. """ calls = [] def tracer(frame, event, arg): calls.append((frame, event, arg)) fakesys.tracer = tracer t = Tracer() t.install() sentinel = object() t._trace(sentinel, 'call', sentinel) assert calls == [(sentinel, 'call', sentinel)]