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 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 in hub/ and also the flake8 linter

  • pytest <path> - to run individual test files

  • npm 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.

Test Coverage

https://gitlab.com/carboncoop/hub/badges/master/coverage.svg