-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Clarify docs on specifying multiple filters with pytest.mark.filterwarnings
#12966
Comments
… using multiple marks
According to the code, it's also possible to pass multiple arguments/filters into one decorator/mark instead of having to have multiple of them: pytest/src/_pytest/warnings.py Lines 59 to 61 in 71a35d4
That seems like a much easier and more consistent way to get to the same result, though it looks like the docs don't do a great job at pointing that out either. @soxofaan would you perhaps be interested in opening another PR detailing that a bit more too? |
Ah that's interesting. I kind of tried something like that by passing a single string with comma-separated filters, following PYTHONWARNINGS, which didn't work. I'll see if I find some time to do a follow-up PR |
… using multiple marks (pytest-dev#12967)
Specifying multiple
filterwarnings
filter in the correct order can be a bit confusing.When using
@pytest.mark.filterwarnings
as decorator, one has to use the reverse order compared to stdlib'swarnings.filterwarnings
(because of the order that decorators are evaluated).When using
pytestmark
(list ofpytest.mark.filterwarnings
marks), it's the other way around.I think this deserves a bit of clarification in the docs
FYI: I'm actually already working on a PR for this
The text was updated successfully, but these errors were encountered: