如何使用PyDev调试Django单元测试? [英] How to debug Django unittests with PyDev?
问题描述
似乎我可以从Pydev运行manage.py test命令,但是没有调试。如果我使用右键单击debug unittest运行unittest,那么我得到所有排序的Internal Server错误,大概是因为测试环境没有正确设置。
设置新的调试配置。
- 运行 - >调试配置...
- 选择'PyDev Django'
- 点击新建启动配置(左上角)
- 命名新配置
- 将项目设置为您的项目
- 将模块设置为manage.py(浏览器到manage.py)
- 转到参数选项卡,并在程序参数下输入test
- 单击应用
这将允许您运行'manage.py test',并能够停止您的断点。
不幸的是,您必须创建不同的配置,如果你只想运行一个测试子集。
i've written a few unittests for a Django project. I'd like to debug them. I've set a break point on the server side. what should I click to run the Django unittest with debugging enabled in PyDev Eclipse?
It seems I can run the manage.py test command from Pydev, but then there's no debugging. If I run the unittest with right-click debug unittest, then I get all sort Internal Server errors presumably because the test envrionment wasnt set up correctly.
Setup a new debug configuration.
- Run -> Debug Configurations...
- Select 'PyDev Django'
- Click 'New Launch Configuration (top left corner)
- Name your new configuration
- Set the project to your project
- Set the module to your manage.py (browser to your manage.py)
- Go to the 'Arguments' tab and enter 'test' under 'Program arguments'
- Click 'Apply'
This will allow you to run 'manage.py test' and be able to stop on your breakpoints.
Unfortunately, you'll have to create different configurations if you only want to run a subset of tests.
这篇关于如何使用PyDev调试Django单元测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!