Skip to content

Enhancement: Align pytest.warns regex mismatch error with pytest.raises (#11225)#14311

Open
harshitlarl wants to merge 3 commits intopytest-dev:mainfrom
harshitlarl:fix-11225-warns-regex
Open

Enhancement: Align pytest.warns regex mismatch error with pytest.raises (#11225)#14311
harshitlarl wants to merge 3 commits intopytest-dev:mainfrom
harshitlarl:fix-11225-warns-regex

Conversation

@harshitlarl
Copy link

Fixes #11225 by aligning the error message for unmatching regex patterns in pytest.warns with the one used for pytest.raises. Handled test updates. Also added hint for re.escape() if the text strictly matches but the regex failed.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Mar 22, 2026
@JaeHyuckSa
Copy link

JaeHyuckSa commented Mar 23, 2026

Hello, @harshitlarl I had already started working on this issue. Could you please close this PR? Also, for future issues, please check the existing PRs and comments on the issue beforehand to avoid duplicating work.

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.

Error message for pytest.warns() if regex patterns don't match

2 participants