Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed invalid regex handling in filterwarnings #13124

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

virendrapatil24
Copy link
Contributor

@virendrapatil24 virendrapatil24 commented Jan 11, 2025

closes #13119

  • Updated the parse_warning_filter method to handle invalid regex pattern provided to message/module args.
  • Added a test case in testing/test_warnings.py to validate the new behavior.
  • Created a changelog fragment to document this improvement.

Copy link
Member

@The-Compiler The-Compiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Definitely much better. New output (with my small suggestion added):

ERROR: while parsing the following warning configuration:

  ignore::DeprecationWarning:*

This error occurred:

Invalid regex '*': nothing to repeat at position 0

src/_pytest/config/__init__.py Outdated Show resolved Hide resolved
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jan 11, 2025
@virendrapatil24 virendrapatil24 marked this pull request as ready for review January 11, 2025 14:45
Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

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.

config option filterwarnings ignore::DeprecationWarning:* crashes with regex exception: PatternError
3 participants