Skip to content

Unit tests

Testing is done using the built-in library unittest. To run all test files in the folder tests/, execute in the project root folder:

python -m unittest

Coverage report

Install the coverage package:

pip install coverage

The command coverage run will replace any python command. To get a coverage report on the unit tests, run the following command:

coverage run -m unittest

To report this to codacy, the .coverage file needs to be translated to the cobertura xml standard:

coverage xml -o cobertura.xml

Before submitting the report, provide an API key using an environmental variable export CODACY_PROJECT_TOKEN=xxxxxxxxxxxxxxxxxxxxx. Now the report can be submitted to codacy using:

bash <(curl -Ls https://coverage.codacy.com/get.sh)