pdb.set_trace() causing frozen nosetests, does not drop into debugger

Bodhi picture Bodhi · Jan 26, 2012 · Viewed 8.6k times · Source

I'm running a suite of tests (.py files) using nosetests. Using a classic

import pdb; pdb.set_trace()

the nosetests run just never completes. It just hangs right where the breakpoint has been set, but never drops into the pdb debugger.

Any ideas why this would be? I've tried moving the breakpoint to a number of different positions (other test functions, other files) to no avail.

Answer

stderr picture stderr · Jan 26, 2012

Run nose with the -s / --nocapture option and you'll be able to see the pdb prompt and interact with the debugger normally.

If using the commandline that means:-

python manage.py  test -s [other-opts-and-args]