better handle errors raised while applying filterwarnings (#7864)#7877
better handle errors raised while applying filterwarnings (#7864)#7877charlesaracil-ulti wants to merge 3 commits intopytest-dev:mainfrom
Conversation
df230aa to
c1eb283
Compare
bluetech
left a comment
There was a problem hiding this comment.
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_filtercan fail in other places than just thewarnings._getcategorycall. 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
ConftestImportFailureis 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.