The project includes a test suite which tests the core features across a number of applications.
This project uses the Pytest, a framework for easily building simple and scalable tests. After you have set up to develop locally, run the following commands to make sure the testing environment is ready: :
$ pytest
You will get a readout of the users app that has already been set up with tests. If you do not want to run the pytest on the entire project, you can target a particular app by typing in its location: :
$ pytest <path-to-app-in-project/app>
If you set up your project to develop locally with docker, run the following command: :
$ docker-compose -f local.yml run --rm django pytest
Targeting particular apps for testing in docker
follows a similar
pattern as previously shown above.
You should build your tests to provide the highest level of code
coverage. You can run the pytest
with code coverage
by typing in
the following command: :
$ 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
note
At the root of the project folder, you will find the pytest.ini file. You can use this to customize the
pytest
to your liking.There is also the .coveragerc. This is the configuration file for the
coverage
tool. You can find out more about configuringcoverage
.
Success
Error
Warning
Info