Skip to content

How to properly escape regex for pytest filterwarnings? #9999

Answered by agoose77
matthewfeickert asked this question in Q&A
Discussion options

You must be logged in to vote

At present, the logic that parses the warning string performs a naive split on the : character, which can't be escaped. I'm not personally familiar with pytest's usage, but I think you can make the group capturing - nothing's done with the output:
ignore:divide by zero encountered in (true_)?divide:RuntimeWarning

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@matthewfeickert
Comment options

Answer selected by matthewfeickert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants