3

Typically I run my python unit test with:

python -m unittest test.<module-name>

I would like to debug my tests using ipdb but I cannot figure out how to invoke theunittest module in manner similar to the command above.

The directory structure is:

  • base/src for the source code
  • base/test for the test code

Tests run from the base directory.

The preference is to 'run' & 'debug' test cases in the same manner, specifically the preference is to debug with ipdb in a similar manner to the python command above.

FYI

Interpreter is python2

DanCat
  • 2,504
  • 2
  • 19
  • 26

1 Answers1

0

I don't know how to do this with the unittest module from the standardlib, but the testrunner pytest has at least pdb (not ipdb) support. Just invoke it with

pytest --pdb

and it drops into pdb with the first failure.

barrios
  • 1,104
  • 1
  • 12
  • 21