现在,我运行事物的方式是,我有一组用pytest编写的测试用例,如果它们失败了,我就修复并重新工作。如果它们通过,我使用pytest-cov来获得覆盖率,并手动确定覆盖率是否足够好。我想知道,如果覆盖率的阈值小于x,pytest是否有可能失败。
pytest --cov=myproject tests --cov-report=html
coverage report --fail-under=80
....
myproject/services/subnet.py 36 33 8%
myproject/severity.py 5 0 100%
--------------------------------------------------------------------------------------------------------------------
TOTAL 8843 8739 1%
....发布于 2019-12-20 14:00:14
您应该使用pytest来运行测试,如果测试失败,则使用pytest。然后使用覆盖率来评估承保额,如果覆盖率在以下,则失败:
pytest --cov=mypackage --cov-report= tests-or-whatever
coverage report --fail-under=80发布于 2021-12-28 18:38:21
如果使用的是pytest-cov,则可以使用--cov-fail-under=MIN
pytest --cov-fail-under=80 [...]https://stackoverflow.com/questions/59420123
复制相似问题