Skip to content

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

Closed
harshitlarl wants to merge 3 commits into
pytest-dev:mainfrom
harshitlarl:fix-11225-warns-regex
Closed

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

Conversation

@harshitlarl

Copy link
Copy Markdown

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

JaeHyuckSa commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

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.

@nicoddemus

Copy link
Copy Markdown
Member

Thanks @harshitlarl, closing as duplicate of #14310.

@nicoddemus nicoddemus closed this Mar 26, 2026
@harshitlarl

Copy link
Copy Markdown
Author

Sure No Worries

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

3 participants