Clarify regex match error in pytest.raises#13855
Closed
dariomesic wants to merge 8 commits intopytest-dev:mainfrom
Closed
Clarify regex match error in pytest.raises#13855dariomesic wants to merge 8 commits intopytest-dev:mainfrom
dariomesic wants to merge 8 commits intopytest-dev:mainfrom
Conversation
Member
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
You might want to remove the comment at the same time ?
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Contributor
Author
Yeah ofcourse, I didn't want to remove it myself until they are okay with it |
Comment saying """ # I don't love "Regex"+"Input" vs something like "expected regex"+"exception message" # when they're similar it's not always obvious which is which" """ is now removed for clarity
for more information, see https://pre-commit.ci
bluetech
requested changes
Oct 29, 2025
Member
bluetech
left a comment
There was a problem hiding this comment.
I left a suggestion. Also need to fix the failing tests.
Co-authored-by: Ran Benita <ran@unusedvar.com>
Pierre-Sassoulas
approved these changes
Oct 29, 2025
c480ceb to
bf27097
Compare
3359dd2 to
582107b
Compare
for more information, see https://pre-commit.ci
Contributor
Author
|
Will create another one with clear instructions and commits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR addresses the
TODOinAbstractRaises._check_matchwhich notes that the error message for a regex mismatch can be confusing.The previous message used
Regex:andInput:, which could be ambiguous.This change updates the
_fail_reasonstring to be more explicit:Regex:->Expected regex:Input:->Actual message:This makes the failure message clearer and easier to debug for users, as requested in the code comment.