How to ignore warnings coming from a particular module? #10650
Unanswered
vect-tmazzucotelli
asked this question in
Q&A
Replies: 1 comment
-
Ah, I think I understand: Would be nice to get it documented in Pytest in the meantime 🙂 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to treat warnings as errors in my tests suite, and ignore some of them.
Here are the warnings:
I tried to ignore them based on their category and module of origin, but it does not work:
filterwarnings = error ignore::DeprecationWarning:scipy.sparse.base ignore::DeprecationWarning:jupyter_core.utils
If I specify a message instead, warnings are correctly ignored:
filterwarnings = error ignore:Please use `spmatrix`:DeprecationWarning ignore:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning
I understand that
module
is a regex that the module's qualified name must match, but I can't seem to get it right.Even this does not work:
filterwarnings = error ignore::DeprecationWarning:.*(scipy|sparse|base|jupyter_core|utils).*
Even weirder, if I use
.*utils.*
as regex, then the scipy warnings are ignored! Bututils
is nowhere to be found in.venv/lib/python3.9/site-packages/scipy/sparse/base.py
!! What is happening 😂 ??Beta Was this translation helpful? Give feedback.
All reactions