fix(conftest_plugin): resolve default_ignore_datasets.yaml from the package#800
Conversation
…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.
|
Warning Review limit reached
Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.
The shared pytest plugin cannot be used by any consumer that installs
climate-reffrom a wheel._use_local_ignore_datasets_fileresolves the ignore list asPath(__file__).parents[4] / "default_ignore_datasets.yaml". That arithmetic only works in this monorepo, where it walkssrc/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
configfixture calls that helper (previously onlysolve_configdid), so every downstream test that requestsconfignow errors during setup: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.yamlinside theclimate_refpackage and resolve it withimportlib.resources, mirroring howcv_cmip7_aft.yamlis already located inconfig.PathConfig._dimensions_cv_factory.The repository-root copy stays where it is:
DEFAULT_IGNORE_DATASETS_URLserves 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_FILENAMEis 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
pytest11entry point):climate-ref==0.16.0— reproducesValueError: Could not find ignore file at .../.venv/default_ignore_datasets.yamlAlso confirmed
default_ignore_datasets.yaml(2062 bytes) is present in the built wheel, and thatparents[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.