Test Driven Development
Pytest has been included in the test environment and should be used. A number of plugins have also been added to improve Pytest.
pytest-watch - watches the directory and runs tests on changes
pytest-testmon - montiors what files are being changed and only runs those tests
pytest-sugar - gives a nicer output
pytest-django - django integration
pytest-cov - coverage reports
coverage-badge - creates a coverage badge for the documentation site
Pytest can be run to continuously watch the application directory and run tests that relate to code that is being changed with this command:
ptw -- --testmon
You can run tests by using one of:
npm test
- which will run all tests inhub/
and also the flake8 linterpytest <path>
- to run individual test filesnpm run coverage
- which will run the tests, and output detailed coverage reports in htmlcov/index.html
You might also want to run type checks with mypy:
mypy hub
If you use type annotations, this can be useful to run occasionally, though it also has quite noisy output.