Testing

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

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

Test Data Access

The test suite requires access to some tide model data files [see Data Access]. For project developers, the data files can be fetched from a permanent open research repository (figshare or zenodo) using the pyTMD.datasets.fetch_test_data() function. These files accessed similarly during continuous integration (CI) testing.

Fetching the data using pixi:

pixi run fetch

Running the Test Suite

Using the pytest command:

pytest --directory <model_path> test/

Using pixi:

pixi run test "--directory <model_path>"

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 pyTMD --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)