Skip to content

Conversation

@lewisjared
Copy link
Contributor

@lewisjared lewisjared commented Jan 6, 2026

Description

This is the first step in reworking how we do sample data.

Diagnostics are now responsible for defining the test datasets they need from ESGF.
These will be able to be selectively fetched/cached as needed so any diagnostic author doesn't require the full set of data (the CI still needs the full set).

This PR adds the data structures for defining test cases, and the CLI to run specific tests.
The next PR will migrate the sample data requests to this new format.

#472

Checklist

Please confirm that this pull request has done the following:

  • Tests added
  • Documentation added (where applicable)
  • Changelog item added to changelog/

* origin/main:
  ci: Update uv in CI
  chore: change to pin for fastprogress
  fix: Bump a yanked version of deprecated
  fix: Add IPython to depedencies temporarily
* origin/main:
  fix: use uv not pip
  docs: Changelog
  ci: Ignore dependabot PRs
  Bump version: 0.8.0 → 0.8.1
  docs: Clean up missing changelogs
  chore(deps): bump the github-actions group with 5 updates
  chore: Add dependabot

# Wrap the runner to convert exceptions to pytest.skip
class PytestTestCaseRunner:
def run(self, diagnostic, test_case_name="default", output_dir=None):
lewisjared and others added 10 commits January 7, 2026 17:24
…mplicit (fall through) returns'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
* origin/main:
  chore: pin xarray for ilamb3 due to issue
  fix: handle a regression in xarray
  fix: Clean up some type hints from updating mypy
  docs: fix typo
  chore(deps-dev): bump the python-dependencies group with 31 updates
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 93.24324% with 30 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ages/climate-ref/src/climate_ref/cli/test_cases.py 88.65% 14 Missing and 8 partials ⚠️
...s/climate-ref-core/src/climate_ref_core/testing.py 87.09% 8 Missing ⚠️
Files with missing lines Coverage Δ
...imate-ref-core/src/climate_ref_core/diagnostics.py 95.80% <100.00%> (+0.08%) ⬆️
...ate-ref-core/src/climate_ref_core/esgf/__init__.py 100.00% <100.00%> (ø)
...climate-ref-core/src/climate_ref_core/esgf/base.py 100.00% <100.00%> (ø)
...limate-ref-core/src/climate_ref_core/esgf/cmip6.py 100.00% <100.00%> (ø)
...mate-ref-core/src/climate_ref_core/esgf/fetcher.py 100.00% <100.00%> (ø)
...ate-ref-core/src/climate_ref_core/esgf/obs4mips.py 100.00% <100.00%> (ø)
...limate-ref-core/src/climate_ref_core/exceptions.py 85.71% <100.00%> (+4.23%) ⬆️
...ate-ref-example/src/climate_ref_example/example.py 97.56% <100.00%> (+0.19%) ⬆️
...ckages/climate-ref/src/climate_ref/cli/__init__.py 97.22% <100.00%> (+0.03%) ⬆️
...ckages/climate-ref/src/climate_ref/cli/datasets.py 90.00% <ø> (ø)
... and 4 more

... and 1 file with indirect coverage changes

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

@lewisjared
Copy link
Contributor Author

This is getting pretty big and have already had a few iterations of cleaning, but is still backwards compatible so I'll get this merged and then add it to the test suite

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a diagnostic-centric test data management system to replace the monolithic test data approach. Each diagnostic now defines its own test data requirements via TestDataSpecification, enabling selective data fetching and independent testing.

Key Changes

  • New ESGF data fetching infrastructure with support for CMIP6 and obs4MIPs datasets
  • CLI commands (ref test-cases fetch/list/run) for managing test cases
  • TestCase and TestDataSpecification classes for defining reproducible test scenarios
  • Test harness with TestCaseRunner and pytest fixtures for diagnostic testing

Reviewed changes

Copilot reviewed 29 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/climate-ref-core/src/climate_ref_core/testing.py Core testing infrastructure with TestCase and TestDataSpecification classes
packages/climate-ref-core/src/climate_ref_core/esgf/ New ESGF module with CMIP6Request, Obs4MIPsRequest, and ESGFFetcher
packages/climate-ref-core/src/climate_ref_core/exceptions.py New test case exceptions (NoTestDataSpecError, TestCaseNotFoundError, DatasetResolutionError)
packages/climate-ref/src/climate_ref/testing.py TestCaseRunner implementation and catalog path utilities
packages/climate-ref/src/climate_ref/cli/test_cases.py New CLI commands for fetching, listing, and running test cases
packages/climate-ref/src/climate_ref/datasets/__init__.py Refactored imports to support new dataset adapters
conftest.py New pytest fixtures (run_test_case, esgf_test_data_dir, esgf_solve_catalog)
docs/how-to-guides/testing-diagnostics.md Comprehensive documentation for the new testing infrastructure
packages/climate-ref-example/src/climate_ref_example/example.py Example diagnostic with test_data_spec
packages/climate-ref-core/pyproject.toml Added intake-esgf and pyarrow dependencies
uv.lock Updated lock file with new dependencies
pyproject.toml Added pytest warning filters for test domain classes
tests/test-data/.gitignore Added esgf-data directory to gitignore
Various test files Comprehensive unit tests for new ESGF and testing infrastructure

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lewisjared lewisjared merged commit e5d2f9a into main Jan 8, 2026
13 checks passed
@lewisjared lewisjared deleted the add-local-datasets branch January 8, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants