Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用鼻子测试来运行一些测试。但是,在测试完成运行后,nosetests 进程就坐在那里,不会退出。有没有办法诊断这个?Python 是否有类似于向 Java 发送 kill -QUIT 的工具来打印堆栈跟踪?
nosetests -vv -x -s --pdb test_foo
其中-x是“在第一个错误或失败后停止运行测试”,-- pdb是“在失败或错误时进入调试器”
另请参阅http://nose.readthedocs.org/en/latest/usage.html
您可以进入调试器并键入bt:
bt
import pdb; pdb.set_trace()
然后你可以单步执行操作,看看它挂在哪里。