MetOffice / MetOffice/ANTS

Add custom unit test markers for optional dependencies

Open
#119 1 comment 0 reactions 0 assignees View on GitHub
🛠️ infrastructure
Dominant language
Python
Stars
7
Forks
10
Avg merge
1d 19h
Merged PRs (30d)
5

Description

# Description

Pytest allows unit tests to be marked with custom metadata, which can be used to run customised sets of unit tests.

We should add custom markers for the unit tests that rely on optional dependencies (mule, shumlib, esmpy), so that these tests can be switched off.

Mule in particular was made optional in #27, and as result the unit tests that require mule are currently skipped if mule is not installed. Once mule is installed as part of the CI process (#117), these tests should always be run by default, to confirm that mule has been installed successfully.

The default behaviour when running `pytest .` should be to run the entire unit test suite. Groups of unit tests should be switched off via `pytest -m "not requires_mule"` or similar.

## Documentation links

- https://docs.pytest.org/en/stable/example/markers.html#mark-examples
- https://docs.pytest.org/en/stable/how-to/mark.html#mark

Contributor guide

Open the contributing guide

Research direction

Start by locating the test configuration and tests that currently skip when mule, shumlib, or esmpy is unavailable. Read the pytest marker documentation linked in the issue, then add markers so `pytest .` runs the full suite while `pytest -m "not requires_mule"` and similar commands exclude optional-dependency tests. Done means the markers are available and the default and filtered commands behave as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.