[英]determining test coverage with py.test + gevent
使用py.test
+ gevent
时如何获得准确的测试覆盖率报告?
我已经尝试过将pytest-cov
插件用于py.test
,这很py.test
,但是在使用gevent时它会生成不准确的报告 。
gevent覆盖问题最近已在coveragepy
中修复。
但是, pytest-cov
无法以coverage>=4
运行。
一种可能的解决方法是,在不使用pytest-cov
插件的情况下,使用coverage.py
的更高版本运行py.test
。
首先,安装coverage >= 4
并卸载pytest-cov
插件:
pip install --pre --upgrade coverage
pip uninstall pytest-cov
将以下设置添加到.coveragerc
:
[run]
concurrency = gevent
然后运行:
coverage run -m py.test
(而不是常规的py.test
运行)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.