Testsuite
The testing framework used for that project is pytest
Usage
From the root project directory (in your project environment):
pytest
Note
No option required as they are already set in pyproject.toml under [tool.pytest.ini_options] section.
The testsuite is considered as a success if the coverage is above 80%.
Writing tests
When writing tests, remember the following tips and guidelines:
Each app as its own
testsdirectory, and almost each module as its owntest_*.pyfile.Use
pytest.mark.django_dbdecorator on each test function that requires database access.When sample or data set is required, use
pytest_factoryboyto create fixtures.
Coverage
After tests, a coveraqe report is printed on the terminal and generated under the htmlcov directory.
Note
Sources and omissions options are specified in pyproject.toml under [tool.coverage.run] section.
PEP8 compliance
To verify the PEP8 compliance of the project source code, flake8 is used.
To run it locally (in your project environment):
flake8
Note
No option required as they are already set in .flake8 file.
Note
In the future, the project testsuite may include the flake8 compliance check directly in the pytest run, using the pytest-flake8 plugin.
Dependencies
The project dev group dependencies are:
pytest-djangopytest-covpytest-factoryboyflake8