Search code examples
djangounit-testingdjango-testingdjango-unittest

Inspecting django unittest errors in pdb


I have a unittest that throws an exception. The exception isn't thrown by my code, it's from somewhere deep within django. I want to open a pdb session at that spot and see what's the haps, but when I open ipython with pdb and run test myapp the test runs, throws the exception, prints it, but pdb doesn't catch anything.

I guess the desperate-man's solution is to open up django's source and insert import pdb; pdb.set_trace() at the spot I want to investigate. But there's gotta be a better way. What am I missing?


Solution

  • perhaps using nosetests to run your tests with the --pdb option would work.