Skip to content

Avoid rechecking RaisesGroup callbacks#14327

Open
raashish1601 wants to merge 1 commit intopytest-dev:mainfrom
raashish1601:fix/raisesgroup-check-callback
Open

Avoid rechecking RaisesGroup callbacks#14327
raashish1601 wants to merge 1 commit intopytest-dev:mainfrom
raashish1601:fix/raisesgroup-check-callback

Conversation

@raashish1601
Copy link

Fixes #14324.

Summary:

  • Keep RaisesGroup.matches() from re-calling the user check callback on actual_exceptions[0] just to build a suggestion.
  • Preserve the group-level check evaluation and derive the RaisesExc(...) hint without invoking user code again.

Validation:

  • python -m pytest testing/python/raises_group.py::test_check testing/python/raises_group.py::test_check_is_only_called_on_the_group testing/python/raises_group.py::test_unwrapped_match_check -q
  • python -m pytest testing/python/raises_group.py::test_raises_group -q

Manual risk:

  • Behavior is covered by targeted regression tests, but the usual upstream CI review is still the final gate.

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.

pytest.RaisesGroup calls the check function with simple exceptions instead of the group

1 participant