Skip to content

Unit test coverage for cf.py - #7259

Draft
trexfeathers wants to merge 10 commits into
SciTools:mainfrom
trexfeathers:cf_reader_zarr
Draft

Unit test coverage for cf.py#7259
trexfeathers wants to merge 10 commits into
SciTools:mainfrom
trexfeathers:cf_reader_zarr

Conversation

@trexfeathers

@trexfeathers trexfeathers commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Description

Ref #6977

Still lots left to do; pushing up as an advanced preview.

Disclosure: heavy use of Copilot for this one, but I have carefully reviewed the full output and made modifications where needed.

To-do 2026-08-27

  • Full unit CFGroup coverage
  • Full unit CFReader coverage
  • Full unit CFVariable coverage

When I refer to full unit coverage I am talking about a dedicated test module delivering said coverage - instead of relying on incidental coverage that is accidentally provided by other unit tests.

Checklist

Important

The Iris core developers are here to help! If anything below is unclear, just post a comment asking for help 😊


Tip

Things you can trigger on this PR:

  • Add this label to trigger benchmarks: benchmark_this Request that this pull request be benchmarked to check if it introduces performance shifts
  • Visit this URL - swapping 9999 for this PR's number - to re-trigger the CLA check:
    https://cla-assistant.io/check/SciTools/iris?pullRequest=9999

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ESadek-MO FYI in case you wanted to know

There should be a conftest.py file in the root/unit and root/integration folders. Additional lower level conftests can be added if it is agreed there is a need.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.68%. Comparing base (cefe4b7) to head (a9d1ccc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7259      +/-   ##
==========================================
+ Coverage   90.42%   90.68%   +0.25%     
==========================================
  Files          93       93              
  Lines       25816    25816              
  Branches     4796     4796              
==========================================
+ Hits        23344    23411      +67     
+ Misses       1693     1650      -43     
+ Partials      779      755      -24     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@scitools-ci scitools-ci Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Templating

This PR includes changes that may be worth sharing via templating. For each file listed below, please either:

  • Action the suggestion via a pull request editing/adding the relevant file in the SciTools/.github templates/ directory. 1
  • Raise an issue against the SciTools/.github repo for the above action if you really don't have 10mins spare right now. Include an assignee, to avoid it being forgotten.
  • Dismiss the suggestion if the changes are not suitable for templating.

You will need to dismiss this review before this PR can be merged. Recommend the reviewer does this as their final action before merging, as this text will continually update as commits come in.

Template candidates

The following changed files are not currently templated, but their parent directories suggest they may be good candidates for a new template to be created:

Footnotes

  1. Include this text in the PR body to avoid any notifications about applying the template changes back to the source repo!
    @scitools-templating: please no update notification on: iris

assert "temp" in cf_group.data_variables


class Test_translate__formula_terms_derived_bounds:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NOTE: I have not yet had time to validate this test class (formula terms are hard!).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done: a9d1ccc

I understand why the tests are written this way, and confirmed they provide 100% coverage.

BUT: I'm sorry to say that this area of the code is so difficult to understand that I've been unable to form a good model of what good 'conceptual coverage' should look like. I.e. the cases we would want to cover regardless of the chosen Iris implementation. I can pursue this further at the reviewer's request, but I can't judge myself whether it is worth it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant