Pdb.set_trace () calls frozen media, misses the debugger

I am running a test suite (.py files) using nosetests. Using classic

import pdb; pdb.set_trace() 

nosetests launches never end. It just hangs right where the breakpoint is set, but it never crashes into the pdb debugger.

Any ideas why this would be? I tried to move the breakpoint to several different positions (other test functions, other files) to no avail.

+50
python pdb nosetests
Jan 26 2018-12-12T00:
source share
3 answers

Launch your nose with the -s / --nocapture option and you can see the pdb prompt and interact normally with the debugger.

If the command line is used, it means: -

 python manage.py test -s [other-opts-and-args] 
+54
Jan 26 '12 at 4:13
source share

The nose writes the output and redirects it. So, the breakpoint is hit, but you just don't see it. You need to disable output redirection so that debug output appears on the screen.

The nose can do this for you if you use:

 from nose.tools import set_trace; set_trace() 

instead:

 import pdb;pdb.set_trace() 
+29
Jan 26 2018-12-12T00:
source share

In my case, the flag flag -s / - nocapture, still did not solve it and dropped the compiler in pdb.

Another reason you might think about this is to use a database such as MySQL as part of your tests so that it is not blocked by another simultaneous process. In my case, I ran a python shell to query the MySQL database through SQL Alchemy and locked the tables. As a result, my nasal tests were dangling - don't run / go out.

I killed python processes that blocked tables and Nose sniffed again

> $ ps auxww | grep python | awk '{print $ 2}' | sudo xargs kill -9

0
Jan 26 '17 at 14:19
source share



All Articles