Testing#
We use pytest for testing. Please try to ensure that all functions are tested, including both unit and integration tests. We aim for 100% coverage where possible.
We use codecov as the coverage reporting tool. This is free for open-source projects and integrates with GitHub actions.
Continuous integration#
A GitHub actions workflow (.github/workflows/test_and_deploy.yml
) has been set up to run (on each commit/PR):
Linting checks (pre-commit).
Testing (only if linting checks pass)
Release to PyPI (only if a git tag is present and if tests pass). Requires
TWINE_API_KEY
from PyPI to be set in repository secrets.Sometimes additional, cross-repository, tests are run such as testing
brainmapper
with a development version ofcellfinder
Many of these workflows use actions from neuroinformatics-unit/actions. Feel free to raise a PR to that repository!
Test data#
Data used by the tests should be kept on GIN and fetched using pooch
.
Test data should not live on GitHub.
To avoid local tests running checks on user data interfering with separate user data on the same machine, tests should mock test-user data by mocking Path.home()
- an example of how to achieve this can be viewed in brainrender-napari
.