Testing
Adadmire uses pytest, freezegun, and pytest-cov for testing. To run the full test suite, install the mentioned packages and adadmire and then call pytest --runslow
from the root of the repository. The tests are located in the tests folder. To skip the slow tests, omit the --runslow
flag. To run a specific test, use the -k
flag, e.g. pytest -k test_transform_data
. To avoid having to install the package repeatedly after each change, we recommend performing an editable install using pip install -e .
. This allows you to modify the source code and run the tests for the modified version without needing to reinstall the package. Note, however, that it is still required to reinstall the package whenever you modify the pyproject.toml file.
# All commands for copy pasting
git clone https://github.com/spang-lab/adadmire.git # clone adadmire
cd adadmire
pip install -e . # install adadmire in editable mode
pip install pytest pytest-cov pytest-xdist freezegun # install testing dependencies
pytest --tb=short # run all fast tests and show short traceback
pytest --runslow # run all tests/test*py files
pytest -k test_transform_data # run tests/test_transform_data.py only
pytest -s # show stdout of commands during tests (useful for debugging)