Skip to content

fix(conftest_plugin): resolve default_ignore_datasets.yaml from the package#800

Merged
lewisjared merged 2 commits into
mainfrom
fix/package-ignore-datasets-file
Jul 8, 2026
Merged

fix(conftest_plugin): resolve default_ignore_datasets.yaml from the package#800
lewisjared merged 2 commits into
mainfrom
fix/package-ignore-datasets-file

Conversation

@lewisjared

Copy link
Copy Markdown
Contributor

The shared pytest plugin cannot be used by any consumer that installs climate-ref from a wheel.

_use_local_ignore_datasets_file resolves the ignore list as Path(__file__).parents[4] / "default_ignore_datasets.yaml". That arithmetic only works in this monorepo, where it walks src/climate_ref/ back up to the repository root. Installed from a wheel, parents[4] is the virtualenv root, the file is not there, and the helper raises. The file is not shipped in the wheel at all.

Since v0.16.0 the per-test config fixture calls that helper (previously only solve_config did), so every downstream test that requests config now errors during setup:

ValueError: Could not find ignore file at /path/to/.venv/default_ignore_datasets.yaml
climate_ref/conftest_plugin.py:243: ValueError

This is how it surfaced in climate-ref-aft, which pins released wheels and had to patch the helper out to upgrade to v0.16.0.

Change

Ship default_ignore_datasets.yaml inside the climate_ref package and resolve it with importlib.resources, mirroring how cv_cmip7_aft.yaml is already located in config.PathConfig._dimensions_cv_factory.

The repository-root copy stays where it is: DEFAULT_IGNORE_DATASETS_URL serves it from the default branch, and every already-released client has that URL baked into its default config. Moving or deleting it would 404 solve-time refresh for existing installs. A test asserts the packaged copy and the root copy stay byte-identical.

DEFAULT_IGNORE_DATASETS_FILENAME is factored out so the filename is written once.

Verification

Built the wheel from this branch and ran a downstream-style test (no monorepo on disk, plugin auto-discovered via the pytest11 entry point):

  • against released climate-ref==0.16.0 — reproduces ValueError: Could not find ignore file at .../.venv/default_ignore_datasets.yaml
  • against this branch — passes

Also confirmed default_ignore_datasets.yaml (2062 bytes) is present in the built wheel, and that parents[4] does not exist in that layout. pytest packages/climate-ref/tests/unit/test_config.py test_conftest_plugin.py → 26 passed, 2 skipped. pre-commit (ruff, mypy) clean.

…ackage

`_use_local_ignore_datasets_file` located the ignore list as
`Path(__file__).parents[4] / "default_ignore_datasets.yaml"`, which only
resolves inside the monorepo source tree. Installed from a wheel that path
lands in the virtualenv root and the helper raises, so every downstream test
requesting the `config` or `solve_config` fixture errors during setup.

Ship the file inside the `climate_ref` package and resolve it with
`importlib.resources`, matching how `cv_cmip7_aft.yaml` is already located.
The repository-root copy stays put, since `DEFAULT_IGNORE_DATASETS_URL` serves
it from the default branch to already-released clients; a test asserts the two
copies do not drift apart.
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@lewisjared, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 75e30268-7406-42bd-ab9b-ae6a2195d18e

📥 Commits

Reviewing files that changed from the base of the PR and between 59e5311 and d89903c.

📒 Files selected for processing (5)
  • changelog/800.fix.md
  • packages/climate-ref/src/climate_ref/config.py
  • packages/climate-ref/src/climate_ref/conftest_plugin.py
  • packages/climate-ref/src/climate_ref/default_ignore_datasets.yaml
  • packages/climate-ref/tests/unit/test_conftest_plugin.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/package-ignore-datasets-file

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
core 92.39% <100.00%> (+<0.01%) ⬆️
providers 86.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/climate-ref/src/climate_ref/config.py 96.53% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lewisjared lewisjared merged commit cf867b6 into main Jul 8, 2026
28 checks passed
@lewisjared lewisjared deleted the fix/package-ignore-datasets-file branch July 8, 2026 14:27
lewisjared added a commit to Climate-REF/climate-ref-aft that referenced this pull request Jul 9, 2026
Bump the pinned climate-ref core, celery, esmvaltool, pmp, and ilamb
components and the worker container image (helm + docker-compose) from
v0.14.3 to v0.16.1, and raise the Python floor to 3.12 to match.

climate-ref v0.15.0 dropped Python 3.11 and made the diagnostic
input-dataset hash deterministic across pandas versions, so existing
databases re-run each execution once on first upgrade. v0.16.1 also ships
default_ignore_datasets.yaml inside the package (Climate-REF/climate-ref#800),
so the test suite no longer needs to work around the upstream test fixture.
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.

1 participant