Testing
Pytest
You should first set up locally without Docker. Run this command to run the tests:
pytest
You can also target a particular app by typing in its location:
pytest <path-to-app-in-project/app>
If you are using Docker:
docker-compose -f local.yml run --rm django pytest
Coverage
You can run the pytest
with code coverage
:
docker-compose -f local.yml run --rm django coverage run -m pytest
Once the tests are complete, in order to see the code coverage, run the following command:
docker-compose -f local.yml run --rm django coverage report