Testing#
emsarray uses tox to run all the test and linting tools.
Python tests use the pytest framework,
mypy is used for type checking,
flake8 and isort check the code formatting,
and the documentation is build using sphinx
Using tox#
The easiest way to install all the test requirements is using Conda:
Make a new Conda environment,
install the required packages using the provided environment file,
install Python and tox.
$ conda env create --name 'emsarray-tests-py3.12' --file continuous-integration/environment.yaml
$ conda activate emsarray-tests-py3.12
$ conda install -c conda-forge python==3.12 tox
Invoke tox to run all the tests:
$ tox run -e py312-pytest-latest py312-pytest-pinned lint docs
Note that this should only be used to run tests for the version of Python you installed in your Conda environment.
Using pytest#
You can invoke pytest directly to run just a subset of the tests.
Set up a new Conda environment, then install emsarray with the testing extra:
$ conda env create --name 'emsarray-development' --file continuous-integration/environment.yaml
$ conda activate emsarray-development
$ conda install -c conda-forge python=3.12 pip
$ pip install -e .[testing]
Invoke pytest to run the tests:
$ pytest