如何在django测试中测试失败时调用ipdb?

时间:2012-05-11 18:50:50

标签: django django-testing

我想在每次测试失败时启动ipdb。 我试过了

$ ipython manage.py test myapp --pdb

但不起作用。

3 个答案:

答案 0 :(得分:10)

如果您pip install ipdbpluginpip install django-nose,然后将django_nose添加到INSTALLED_APPS并设置TEST_RUNNER = 'django_nose.NoseTestSuiteRunner',则可以致电:

./manage.py test --ipdb

./manage.py test --ipdb-failures

有关详细信息,请参阅https://github.com/flavioamieiro/nose-ipdbhttps://github.com/django-nose/django-nose

答案 1 :(得分:2)

您需要安装nosedjango-nose包裹。为项目配置django-nose后,将使用test测试运行器支持来增强默认测试运行器和nose管理命令。

这是python manage.py help test命令的a gist with the output,它显示了在设置后运行测试所获得的令人印象深刻的选项列表。

答案 2 :(得分:1)

您可以使用django-pdb应用。仅安装在您的设置项目中

相关问题