[英]Can PyCharm drop into debug when py.test tests fail
When running tests with py.test
there is a --pdb
option to enter pdb on failure. 使用
py.test
运行测试时,有一个--pdb
选项可在失败时输入pdb。
Is there a similar way to enter the debugger when running the same test from within PyCharm? 在PyCharm中运行相同的测试时是否有类似的方法进入调试器?
有一个py.test插件pytest-pycharm ,它会在测试发出未捕获的异常时暂停PyCharm调试器。
Follow the steps below to setup the correct run configuration: 请按照以下步骤设置正确的运行配置:
Script : The path to your py.test executable (find by typing which py.test
) 脚本 :py.test可执行文件的路径(通过键入
which py.test
)
Script Parameters : This parameter is your test case followed by the --pdb
option (ie /Users/Johan/projects/misc/testing.py --pdb
) 脚本参数 :此参数是您的测试用例,后跟
--pdb
选项(即/Users/Johan/projects/misc/testing.py --pdb
)
After setting up the configuration, you can run the test case from within PyCharm. 设置配置后,您可以在PyCharm中运行测试用例。 If a test case fails, your PyCharm run window will show the pdb prompt.
如果测试用例失败,PyCharm运行窗口将显示pdb提示符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.