coverage ---- Python unit test and code coverage tool 代码覆盖率探测
文章目录
report 中包含大量 site-packages 模块测试
- 参考:coverage run does not ignore .venv dir
解决办法
coverage run --omit ".venv/*" -m pytest tests
修复 report, no source code error
情况一
案例
py38 run-test: commands[3] | coverage html --skip-covered No source for code: '/mnt/d/source/infrared_quantity/D:\source\infrared_quantity\tests\test_textrender.py'. Aborting report output, consider using -i. ERROR: InvocationError for command /mnt/d/source/infrared_quantity/.tox/py38/bin/coverage html --skip-covered (exited with code 1)
修复方法
- 删除 ".pyc" 文件
find tests/ -iname "*.pyc"|xargs rm
文章作者
上次更新 2022-03-03 (5c64003)