-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
better handle errors raised while applying filterwarnings (#7864) #7877
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
better handle errors raised while applying filterwarnings (#7864) #7877
Conversation
df230aa
to
c1eb283
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @charlesaracil-ulti.
Some comments:
-
It would be good if the error says which warning filter causes the problem.
-
The function
parse_warning_filter
can fail in other places than just thewarnings._getcategory
call. It would be good to handle all sort of invalid warning filters while we're at it. -
Right now the exception would be raised "lazily", i.e. only is something actually triggers it -- which might be a config-time warning, or in the likely case that there isn't one, during the first test setup. We should maybe consider doing a "pre-check" so it's always triggered consistently and then can be assumed to be valid. Though it will slow down startup a tiny bit...
-
It would be nice (though not absolutely necessary) to format the exception a little more nicely, like a
ConftestImportFailure
is formatted for example. Might not be worth the effort though...
When I get some time I'll try to provide some pointers if needed.
Thanks @bluetech! |
Didn't have as many time today as I expected, still addressed your 1. to get one thing done, will get back to it asap |
closes #7864
Add a more explicit error when raising exception while trying to import filterwarnings.