-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Description
Bug report
Bug description:
# Add a code block here, if requiredI have found that I cannot filter warnings that start with an empty line. Like this warning in pandas: https://github.com/pandas-dev/pandas/blob/488f6bd5c08111603549d42effc6dbb7fec935f0/pandas/__init__.py#L221-L231
On a project that I work (napari) we have a rule "error:::napari" in pytest that changes all warning into errors. If it is possible, then we solve warnings immediately, but some of them needs to be ignored (like linked one).
Based on documentation, I assume that rule "ignore:Pyarrow will become a required dependency of pandas in the next major release of pandas.*:DeprecationWarning", should work. But it don't.
Rule is effectively calling warnings.filterwarnings("ignore", "Pyarrow will become a required dependency of pandas in the next major release of pandas.*", DeprecationWarning).
I have found that in filterwarnings the message is changed to regexp using only re.IGNORECASE flag
Line 160 in d1b031c
| message = re.compile(message, re.I) |
re.MULTILINE flag.
And then the match of the regexp is used
Line 375 in d1b031c
| if ((msg is None or msg.match(text)) and |
Based on my knowledge, the problem could be solved by either adding re.MULTILINE to compile flags or using msg.search during filtering.
Which solution is preferred? I could make a PR if someone point which one I should select.
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
Projects
Status