Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pytest-cov cover many applications at once

I built django project with many applications. Now I want to generate a coverage report for these applications. For testing purposes, I use py.test, pytest-django and pytest-cov. So far, I can generate the report only by typing all my app names manually on the command line:

py.test --cov-report html --cov=app1 --cov=app2 --cov=app3 --cov=app4 */tests.py

Does pytest-cov have a way to specify all the applications with a simple expression?

like image 851
Illarion Khlestov Avatar asked Feb 01 '26 02:02

Illarion Khlestov


1 Answers

Assuming you're using bash, you could use it to expand the parameters:

py.test --cov-report html --cov=app{1,2,3,4} */tests.py

You could also add those parameters to pytest.ini so they're passed automatically on each invocation.

like image 111
The Compiler Avatar answered Feb 02 '26 16:02

The Compiler