Skip to content

Conversation

@sadielbartholomew
Copy link
Member

Add unittest skipping (including moving relevant imports and logic where necessary) in all cases where an optional dependencies (esmpy, scipy, matplotlib, access to the ncdump command via nco install or otherwise, etc.) are required, either as called in the test method itself or used under-the-hood in the cf logic.

This includes some fixes for cases where we already had such skips where esmpy is required, but there was logic at module-level which meant the unavailability of the module would be raised as an error before the test methods ran.

As tested locally via setting up a conda environment without any of the optionals in it:

$ conda create --name cf-313-nooptional python=3.13
$ conda activate cf-313-nooptional
$ conda install -c conda-forge cf-python udunits2

and ensuring we only have passes and skips.

(Thought I might as well sort this whilst reviewing our Python version minimum and maximum support.)

@sadielbartholomew sadielbartholomew self-assigned this Oct 15, 2025
@sadielbartholomew sadielbartholomew added the testing Issues related to units tests and their coverage label Oct 15, 2025
Copy link
Collaborator

@davidhassell davidhassell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. scipy is not an optional dependency, so perhaps not put those changes in?

@sadielbartholomew
Copy link
Member Author

sadielbartholomew commented Oct 15, 2025

Looks good. scipy is not an optional dependency, so perhaps not put those changes in?

Ah, good point, thanks! I seem to recall it used to be only optional, some years back (git blame on our requirements file seems to back this up) - hence why I thought it was. I'll revert any skips on SciPy.

@sadielbartholomew
Copy link
Member Author

Hold the merge! Making some improvements in a few new commits...

@sadielbartholomew sadielbartholomew merged commit ed814fa into NCAS-CMS:main Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Issues related to units tests and their coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants