We use pytest for automated tests. Look to its documentation for examples and guidelines. The tests in this repository can also serve as a starting point.
All tests should be under the tests/
directory under a correct subfolder for the module, e.g. raster_processing/
. Put test of one module into one file, for example, clip_test.py
to test clipping functions.
running tests is as simple as executing
pytest
or if you are not inside Poetry shell
poetry run pytest
in the container's command line.
All functionality that can reasonably be tested should have tests!
Writing meaningful tests requires sensible input data. All data used for testing functionalities of the eis_toolkit
should be stored under tests/data/
. Here you have two subdirectories for storing data:
tests/data/remote/
to host data that should be pushed to remote
Do not add anything here unless you specifically need it on the remote
File sizes matter here - favour small files
tests/data/local/
to host data that should be ignored by git (i.e. not pushed to the remote). Good for closed data or large files. Use this by default for storing any data.
The tests/data/local/
directory is split to two subdirectories as well:
tests/data/local/data/
to host the input data for testing
If you have access to EIS-specific testing data, extract it here!
tests/data/local/results/
to host all files generated by tests
Here's an example of what the file structure looks like:
tests/data
├── local
│ ├── data
│ │ ├── <a copy of the EIS testing data folder>
│ │ └── <any other data for testing>
│ └── results
│ └── <files generated by testing>
└── remote
└── <data on remote>
Jupyterlab could also come in handy if you want to experiment. See more instructions here.