How can I enforce 100% line coverage for test files in Python?

64 views Asked by At

In my project I don't test on different architectures / systems. For this reason every single line of the tests/ folder should be executed. If it's not, it's a clear indicator that something went wrong.

I tried this:

pytest core/tests --cov --cov-report term-missing --cov-fail-under 100

But it fails as the whole project doesn't have 100% line coverage. I just want the core/tests folder to have 100% line coverage.

Bonus points if there is a way to check a single test, e.g.

pytest core/tests/test_demo.py --cov --cov-report term-missing --cov-fail-under 100

to only check if all lines of test_demo.py are covered.

0

There are 0 answers