Reading a long traceback is fine until the value I need is only visible at the moment of failure.
python3 -m pytest -x --pdb tests/test_api.py
--pdb starts the interactive debugger at the point of a failure or an unhandled exception inside a test, with the test’s local variables available. -x stops after the first failure so you land in only one prompt. Inside pdb, p name prints a value, w shows the stack and c continues. Do not use it in CI, because the run would wait for input forever.
Further reading: pytest usage documentation