Skip to content

Excercise assert_collect_raises with engine fixture#22563

Merged
rapids-bot[bot] merged 4 commits into
rapidsai:mainfrom
mroeschke:cudf_polars/ref/collect_raises_engines
May 20, 2026
Merged

Excercise assert_collect_raises with engine fixture#22563
rapids-bot[bot] merged 4 commits into
rapidsai:mainfrom
mroeschke:cudf_polars/ref/collect_raises_engines

Conversation

@mroeschke
Copy link
Copy Markdown
Contributor

Description

The pattern that was replaced in #22535 would only test that collection errors were raised with the in-memory engine.

As apart of #22346, we should ensure that our other engines also exhibit a collection error.

Also checks if tests that were skipped in #21828 no longer segfault

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke self-assigned this May 18, 2026
@mroeschke mroeschke requested a review from a team as a code owner May 18, 2026 22:32
@mroeschke mroeschke added the improvement Improvement / enhancement to an existing function label May 18, 2026
@mroeschke mroeschke requested a review from vyasr May 18, 2026 22:32
@mroeschke mroeschke added the non-breaking Non-breaking change label May 18, 2026
@github-actions github-actions Bot added Python Affects Python cuDF API. cudf-polars Issues specific to cudf-polars labels May 18, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python May 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates test assertions and execution patterns across four test modules to standardize behavior when running under streaming versus non-streaming GPU engines. Boolean and string tests that were previously skipped on streaming engines are now enabled, while casting and string validation tests are updated to branch error assertions based on engine type.

Changes

Test execution parity across engine types

Layer / File(s) Summary
Remove skip guards to enable tests on streaming engines
python/cudf_polars/tests/expressions/test_booleanfunction.py, python/cudf_polars/tests/expressions/test_stringfunction.py
is_streaming_engine import is removed from boolean tests and skip guards are deleted from test_boolean_function_unary and test_boolean_horizontal, allowing them to run on streaming engines. String pad test skip guard is also removed to enable execution on streaming engines.
Branch error assertions based on engine type
python/cudf_polars/tests/expressions/test_casting.py, python/cudf_polars/tests/expressions/test_stringfunction.py
Tests are updated to use pytest.RaisesGroup for streaming engines and pytest.raises for non-streaming engines when asserting collection errors. Changes apply to casting strict-mode tests and string function validation (to_datetime, string_to_numeric_invalid, string_zfill_forbidden_chars).
Standardize engine fixture usage in collection calls
python/cudf_polars/tests/expressions/test_datetime_basic.py, python/cudf_polars/tests/expressions/test_stringfunction.py
Tests are modified to use the provided engine fixture parameter during collection instead of constructing explicit in-memory engines, ensuring consistent engine invocation in error paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • rapidsai/cudf#22535: Related changes to exception assertion patterns in the same test files, replacing assert_collect_raises with explicit pytest.raises for collection error paths.

Suggested labels

Python, cudf-polars

Suggested reviewers

  • vyasr
  • nirandaperera
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the motivation for the changes: ensuring collection errors are tested with multiple engines (not just in-memory), referencing related issues, and verifying previously skipped tests no longer segfault.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title mentions 'assert_collect_raises with engine fixture', which directly corresponds to the main objective of modifying tests to use the engine fixture instead of the in-memory engine for testing collection error behavior across different engines.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/cudf_polars/tests/expressions/test_stringfunction.py`:
- Line 595: Wrap the engine-backed call q.collect(engine=engine) in the same
pytest.raises(...) assertion used for the non-engine negative `fill` path so the
test verifies the expected exception for engine execution; locate the test that
exercises `q` and `engine`, replace the bare q.collect(engine=engine) with a
with pytest.raises(ExpectedError): q.collect(engine=engine) (use the same
exception type/class used elsewhere in this test file for the negative `fill`
path).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d0f423c9-991c-4700-ac61-de60cba6ef2f

📥 Commits

Reviewing files that changed from the base of the PR and between f239649 and e35c88d.

📒 Files selected for processing (4)
  • python/cudf_polars/tests/expressions/test_booleanfunction.py
  • python/cudf_polars/tests/expressions/test_casting.py
  • python/cudf_polars/tests/expressions/test_datetime_basic.py
  • python/cudf_polars/tests/expressions/test_stringfunction.py
💤 Files with no reviewable changes (1)
  • python/cudf_polars/tests/expressions/test_booleanfunction.py

Comment thread python/cudf_polars/tests/expressions/test_stringfunction.py
@pentschev pentschev changed the title Excercise assert_collect_raies with engine fixture Excercise assert_collect_raises with engine fixture May 19, 2026
@mroeschke
Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot rapids-bot Bot merged commit 48a1eec into rapidsai:main May 20, 2026
159 of 161 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python May 20, 2026
@mroeschke mroeschke deleted the cudf_polars/ref/collect_raises_engines branch May 20, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cudf-polars Issues specific to cudf-polars improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants