Speed up debugging after a failing run.
Section: pytest and unittest Debugging
Re-run only last failed tests
bash
bash
pytest --lfLearn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing pytest and unittest Debugging
Drop into pdb on failure
Open the debugger automatically when a test fails.
Show local variables in tracebacks
Reveal local state in failing assertions and exceptions.