Description
Description of the desired feature
PyGMT's test suite is growing, and in the long-term, we'll need to make testing a bit more efficient for contributors. As a goal, we should aim for ~10 minutes for the whole test suite (Windows takes up ~30min 15min now (see #586)), and <1 minute for local tests on just one module.
Here's a few ways we can tackle this (note to maintainers, feel free to edit this top post):
Local tests
Running make test
can be slow since it runs everything, but sometimes we only want to test one function (e.g. grdimage
).
- E.g. at Wrap meca #516 (comment), we should document that contributors can run just one test using something like
pytest -v --mpl pygmt/tests/test_grdimage.py
. - Alternatively, look into something like
pytest-fastest
to automate testing only the code that has changed between the current branch and master.
Github Actions tests
Installing dependencies
The bulk of the CI time is spent installing dependencies from conda (4min on Linux, 9min on Windows). We could:
- Cache dependencies. This was experimented before, but it didn't seem to help (see Run Continuous Integration tests on Github Actions #475 (comment)), could try again to see things have changed
- Try switching to
mamba
which is a fast reimplementation ofconda
written in C++. I've tried it before, but it's still in experimental mode at setup-miniconda, see https://github.com/conda-incubator/setup-miniconda#example-6-mamba (Use mamba to install Continuous Integration dependencies #841)
Speed up full test suite
Find a way to run a minimal set of tests when Pull Request is in draft, and only full test suite when Pull Request is ready to review/in review?
Are you willing to help implement and maintain this feature? Let's do it together 😄