Can I debug with python debugger when using py.test somehow?

Posted by Joel on Stack Overflow See other posts from Stack Overflow or by Joel
Published on 2010-04-20T21:28:14Z Indexed on 2010/04/20 21:33 UTC
Read the original article Hit count: 383

Filed under:
|
|

I am using py.test for unit testing my python program. I wish to debug my test code with the python debugger the normal way (by which i mean pdb.set_trace() in the code) but I can't make it work.

Putting pdb.set_trace() in the code doesn't work (raises IOError: reading from stdin while output is captured). I have also tried running py.test with the option --pdb but that doesn't seem to do the trick if I want to explore what happens before my assertion. It breaks when an assertion fails, and moving on from that line means terminating the program.

Does anyone know a way to get debugging, or is debugging and py.test just not meant to be together?

© Stack Overflow or respective owner

Related posts about python

Related posts about unit-testing