pytest-trio
pytest-trio copied to clipboard
tracebackhide is too aggressive when debugging fixture crashes
I use pdbpp, which understands __tracebackhide__ like pytest does. Today, pytest --pdb on a simultaneous fixture+test crash dumped me at
[10] > [...]/lib/python3.8/site-packages/_pytest/python.py(166)pytest_pyfunc_call()
-> result = testfunction(**testargs)
9 frames hidden (try 'help hidden_frames')
with no hint as to where I could find the constituent exceptions of the MultiError. It turns out that all the frames it passed through after being raised were hidden:
[17] [...]/lib/python3.8/site-packages/trio/testing/_trio_test.py(29)wrapper()
-> return _core.run(
[18] [...]/lib/python3.8/site-packages/trio/_core/_run.py(1804)run()
-> raise runner.main_task_outcome.error
[19] [...]/lib/python3.8/site-packages/pytest_trio/plugin.py(343)_bootstrap_fixtures_and_run_test()
-> raise trio.MultiError(test_ctx.error_list)
It seems like maybe we should remove the __tracebackhide__ from _bootstrap_fixtures_and_run_test? If the traceback starts somewhere within the test, it's pretty obvious that this thing called _bootstrap_fixtures_and_run_test is a boundary above which you're not going to find your own code. If it starts in the raise MultiError line in that function, having the frame not hidden is pretty useful in understanding what happened.