Testing

FirnCorr uses the pytest framework to run tests and verify outputs. Running the test suite requires a dev installation of the FirnCorr package to include all of the optional dependencies.

python -m pip install --editable '.[dev]'

Running the Test Suite

Using the pytest command:

pytest --directory test/

Using pixi:

pixi run test

The test suite is run in verbose mode as a default.

Coverage Reports

Coverage reports can be generated using the pytest-cov plugin (which is installed with the dev installation).

pytest --cov FirnCorr --cov-report=term
pixi run coverage

Parallelization

As a default, the pytest suite is run in parallel using the pytest-xdist plugin (which is also installed with the dev installation). To run in series and disable parallelization, set the number of processes to 0:

pytest -n 0
pixi run test "-n 0"

Continuous Integration

We use GitHub Actions continuous integration (CI) services to build and test the project on Linux (ubuntu-latest), Mac (macos-latest), and Windows (windows-latest) Operating Systems. The configuration files for this service are in the GitHub workflows directory. Most of the workflows use pixi to install the required dependencies and build the custom environment.

The GitHub Actions jobs include:

  • Verifying that the code meets style guidelines using ruff

  • Running flake8 to check the code for compilation errors

  • Running the test suite on different operating systems

  • Creating a comment with test coverage statistics

  • Uploading source and wheel distributions to PyPI (on releases)