[Django]-Pytest-cov cover many applications at once

5👍

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.

3👍

@the-compiler ‘s answer did not work for me. If you want to test all apps, here is a way to do it:

pytest --cov-report html --cov=. */tests.py

source: https://medium.com/@harshvb7/using-pytest-to-write-tests-in-django-6783674c55b8

👤cgl

0👍

Before

enter image description here

enter image description here

After

enter image description here

Change this line in pytest.ini

python_files = tests.py test_*.py */tests_*.py

enter image description here

coverage run -m pytest
👤lava

Leave a comment