it’s real simple: put an assert 0
where you want to start debugging in your code and run your tests with:
py.test --pdb
done 🙂
Alternatively, if you are using pytest-2.0.1 or above, there also is the pytest.set_trace()
helper which you can put anywhere in your test code. Here are the docs. It will take care to internally disable capturing before sending you to the pdb debugger command-line.