当使用py.test
+ gevent
时,如何获得准确的测试覆盖率报告?
我已经尝试了显而易见的方法,使用pytest-cov
插件进行py.test
测试,但是当使用gevent时,它会生成不准确的报告。
当使用py.test
+ gevent
时,如何获得准确的测试覆盖率报告?
我已经尝试了显而易见的方法,使用pytest-cov
插件进行py.test
测试,但是当使用gevent时,它会生成不准确的报告。
coverage>=4
时,pytest-cov
无法运行。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
运行)