Description
While generating coverage reports is super important, in order to use coverage in CI workflows, sometimes you want to enforce a certain coverage percentage.
Python's coverage library do that using the --fail-under flag which cause the coverage method to fail if coverage percentage is under than expected.
API
Simply add the --fail-under flag to the coverage execution with the desired coverage percentage. For example, --fail-under=90 will enforce at least 90% coverage and --fail-under=100 will enfore total coverage (100%).
Description
While generating coverage reports is super important, in order to use coverage in CI workflows, sometimes you want to enforce a certain coverage percentage.
Python's coverage library do that using the
--fail-underflag which cause the coverage method to fail if coverage percentage is under than expected.API
Simply add the
--fail-underflag to the coverage execution with the desired coverage percentage. For example,--fail-under=90will enforce at least 90% coverage and--fail-under=100will enfore total coverage (100%).