How to debug py.test in PyCharm when coverage is enabled

妖精的绣舞 提交于 2019-12-22 01:51:35

问题


How do I debug py.test in PyCharm when coverage is enabled?

Coverage is enabled using --cov=project --cov-report=term-missing, removing this and breakpoints are hit.

Versions: pycharm 5.0.3, pytest==2.8.5, pytest-cache==1.0, pytest-cov==2.2.0, pytest-pep8==1.0.6, pytest-xdist==1.13.1, python-coveralls==2.6.0.

(thanks for jon's advice on further diagnosing the issue)


回答1:


There is now a flag in py.test to disable coverage which you can activate when running tests from PyCharm.

The flag to use is --no-cov. If you want this to apply to all your test runs you can add this to the default pytest configuration as below:

Extra tip: You probably also want a -s flag in there so output isn't swallowed by py.test. See https://stackoverflow.com/a/17810324/238166 for details.

In case you receive an "unrecognized argument" error, you may need to install pytest-cov, e.g. by pip install pytest-cov.



来源:https://stackoverflow.com/questions/34870962/how-to-debug-py-test-in-pycharm-when-coverage-is-enabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!