DEV Community

Serhat Teker
Serhat Teker

Posted on • Originally published at tech.serhatteker.com on

Postmortem Debugging in pytest

If you'd like to debug your code/test if only it throws an error run:

$ pytest -x --pdb
Enter fullscreen mode Exit fullscreen mode

This will put you into pdb on the first failure.

-x flag makes pytest stop on the first failure. If you want to invoke the pdb on every failure -I dont' think, run without x flag:

$ pytest --pdb
Enter fullscreen mode Exit fullscreen mode

For more info you can look at: pytest failures

All done!

Top comments (0)