Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
https://ibb.co/y4J3JrG
Coverage.py(它是 pytest-cov 的引擎)具有总覆盖率的阈值,但没有针对不同测量的单独阈值。看看--fail-under选项。
--fail-under
Coverage.py 可以测量语句覆盖率和分支覆盖率。您提到“行”覆盖率和“代码”覆盖率:我不知道它们与语句覆盖率有何不同。
您可以找到所需的选项,如下所示:
pytest --帮助
--cov-fail-under=MIN 如果总覆盖率小于 MIN 则失败。