I have a flaky test which failure is not reproducible for me.
def test_bar(): ... foo = bar(blue) assert foo == 'sunshine'
Up to now I only see a meaningless error message of the test fails.
moonlight != sunshine
I would like to trace
bar() every time it is called in the test.
If the assertion fails, then I want to see the trace as text.
The trace should contain all lines which get executed by
bar() (excluding Python stdlib).
Maybe something like this:
def test_bar(): ... tracer = SomeMagicTracer() foo = tracer.call(bar, blue) assert foo == 'sunshine', tracer.trace_to_text()
How to get