我怎样才能得到一个 增量报告 Python 中的代码覆盖率?
通过“增量”,我的意思是自某些“上次”报告或特定 Git 提交以来所涵盖行的变化。
我正在使用 unittest
和 coverage
(和coveralls.io)获取代码覆盖率统计信息,这很好用。但是我只参与了项目的一部分,一开始我关心的是什么我最后一次提交 已经改变。我期待 coverage
能够显示两个报告之间的差异,但到目前为止还没有发现除了在 HTML 输出上运行文本差异之外的任何内容。
最佳答案
简介
我用 pycobertura .pycobertura diff --format html --output cov_diff.html coverage_old.xml coverage_new.xml
详情
我使用以下链( coverage ):
python -m coverage run -m unittest
coverage xml --omit tests/* -o cover_old.xml
python -m coverage run -m unittest
coverage xml --omit tests/* -o cover_new.xml
pycobertura diff --format html --output cov_diff.html coverage_old.xml coverage_new.xml
关于python - Python 单元测试的增量代码覆盖率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49447326/