Skip to content

CI Switch to strict xfail policy for common estimator checks - #7753

Merged
rapids-bot[bot] merged 4 commits into
NVIDIA:mainfrom
betatim:make-sklearn-compat-checks-strict
Feb 5, 2026
Merged

CI Switch to strict xfail policy for common estimator checks#7753
rapids-bot[bot] merged 4 commits into
NVIDIA:mainfrom
betatim:make-sklearn-compat-checks-strict

Conversation

@betatim

@betatim betatim commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

This runs the scikit-learn common estimator checks in strict mode. This means a test marked as xfail that passes leads to a failure. This helps us keep the xfail list current and notice flaky checks.

fixes #7346

@betatim
betatim requested a review from a team as a code owner February 3, 2026 09:26
@betatim
betatim requested a review from viclafargue February 3, 2026 09:26
@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Feb 3, 2026
@betatim betatim added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change and removed Cython / Python Cython or Python issue labels Feb 3, 2026
@csadorf

csadorf commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Is this ready for review?

@github-actions github-actions Bot added the Cython / Python Cython or Python issue label Feb 4, 2026
@betatim

betatim commented Feb 4, 2026

Copy link
Copy Markdown
Contributor Author

Ready for review (modulo figuring out the CI failures which seem to be unrelated to the PR content)

@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Raised scikit-learn minimum version to 1.8 for test compatibility.
  • Tests
    • Enforced stricter handling of expected test failures, reducing the set of checks marked as expected failures.
    • Retained targeted workarounds and a few disabled checks for known issues to keep test stability.

Walkthrough

Enabled stricter xfail enforcement in scikit-learn compatibility tests by adding xfail_strict=True to parametrize_with_checks, raised scikit-learn minversion to 1.8, and removed many previously-expected xfail entries from the per-estimator xfail list.

Changes

Cohort / File(s) Summary
Test decorator & xfail list
python/cuml/tests/test_sklearn_compatibility.py
Added xfail_strict=True to estimator_checks.parametrize_with_checks; updated importorskip minversion from 1.7 to 1.8; pruned many entries from the PER_ESTIMATOR_XFAIL_CHECKS (removed numerous check_* items across many estimators), while keeping a few targeted workarounds (e.g., AgglomerativeClustering, UMAP.nan_inf).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: switching to strict xfail policy for sklearn estimator checks.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of switching to strict mode and referencing the linked issue.
Linked Issues check ✅ Passed The PR fully addresses issue #7346 by updating parametrize_with_checks to include xfail_strict=True and removing no-longer-failing checks.
Out of Scope Changes check ✅ Passed All changes are directly related to enabling strict xfail handling in test_sklearn_compatibility.py as required by issue #7346.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@python/cuml/tests/test_sklearn_compatibility.py`:
- Around line 42-44: Remove the blanket skip by deleting
pytest.importorskip("sklearn", minversion="1.8") and instead detect sklearn
version at runtime (using sklearn.__version__ or packaging.version.parse) to set
a module-level flag (e.g., SKLEARN_SUPPORTS_STRICT_XFAIL). Use that flag when
calling or decorating with parameterize_with_checks (or when passing
xfail_strict) so xfail_strict=True is only used when
SKLEARN_SUPPORTS_STRICT_XFAIL is True, while allowing the rest of the sklearn
compatibility tests (parameterize_with_checks) to run on older versions; update
any uses of xfail_strict to reference this flag.
🧹 Nitpick comments (1)
python/cuml/tests/test_sklearn_compatibility.py (1)

596-622: Remove commented-out xfail entries or add a rationale.

Leaving disabled keys as comments makes the strict-xfail list harder to audit. Consider removing them entirely (or add an explicit rationale if you want to keep the history in-file).

♻️ Suggested cleanup
-        # "check_no_attributes_set_in_init": "GaussianRandomProjection sets attributes during init",
...
-        # "check_parameters_default_constructible": "GaussianRandomProjection parameters are mutated on init",

Comment thread python/cuml/tests/test_sklearn_compatibility.py
@csadorf

csadorf commented Feb 5, 2026

Copy link
Copy Markdown
Contributor

/merge

@rapids-bot
rapids-bot Bot merged commit c927131 into NVIDIA:main Feb 5, 2026
105 checks passed
@betatim betatim mentioned this pull request Feb 5, 2026
rapids-bot Bot pushed a commit that referenced this pull request Feb 5, 2026
I think what happened is that #7751 fixed something that used to lead to the `check_do_not_raise_errors_in_init_or_set_params` check failing. The reason we ended up seeing it in #7632 is that #7751 was merged before #7753 (and we didnt rerun the CI for that PR).

Authors:
  - Tim Head (https://github.com/betatim)

Approvers:
  - Jim Crist-Harif (https://github.com/jcrist)
  - Simon Adorf (https://github.com/csadorf)

URL: #7768
@betatim
betatim deleted the make-sklearn-compat-checks-strict branch February 6, 2026 09:35
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 17, 2026
…7753)

This runs the scikit-learn common estimator checks in strict mode. This means a test marked as xfail that passes leads to a failure. This helps us keep the xfail list current and notice flaky checks.

fixes NVIDIA#7346

Authors:
  - Tim Head (https://github.com/betatim)

Approvers:
  - Simon Adorf (https://github.com/csadorf)

URL: NVIDIA#7753
dantegd added a commit to dantegd/cuml that referenced this pull request Feb 17, 2026
I think what happened is that NVIDIA#7751 fixed something that used to lead to the `check_do_not_raise_errors_in_init_or_set_params` check failing. The reason we ended up seeing it in NVIDIA#7632 is that NVIDIA#7751 was merged before NVIDIA#7753 (and we didnt rerun the CI for that PR).

Authors:
  - Tim Head (https://github.com/betatim)

Approvers:
  - Jim Crist-Harif (https://github.com/jcrist)
  - Simon Adorf (https://github.com/csadorf)

URL: NVIDIA#7768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cython / Python Cython or Python issue improvement Improvement / enhancement to an existing function non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make checks in test_sklearn_compatibility.py strict

4 participants