Skip to content

Conversation

@dariomesic
Copy link
Contributor

Purpose

This PR addresses a TODO in testing/python/raises_group.py that pointed out a poorly structured sentence in a test's expected error message.

I traced this back to the source of the message in src/_pytest/raises.py and refactored it to be clearer and more direct.

  • Old format: expected exception must be a BaseException type, not '...'
  • New format: Expected a BaseException type, but got '...'

Tests

Because the library's error message was changed, this PR also updates all the tests in the following files that were asserting the old message:

  • testing/python/raises.py
  • testing/python/raises_group.py

This resolves the TODO and makes the error messages more consistent and readable.

@dariomesic dariomesic force-pushed the fix-raises-error-messages branch from de713cb to b1fc8a1 Compare October 29, 2025 22:24
@dariomesic dariomesic force-pushed the fix-raises-error-messages branch from 0782838 to b030c3f Compare October 29, 2025 22:31
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 29, 2025
@dariomesic dariomesic marked this pull request as ready for review October 29, 2025 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant