-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Why is pytest aggressively escaping the message string provided to pytest.mark.filterwarnings
?
#3785
Comments
pytest.mark.filterwarnings
?pytest.mark.filterwarnings
?
CC @nicoddemus https://github.com/pytest-dev/pytest/blob/master/src/_pytest/warnings.py#L68 uses the warnings module they differ in escaping its not clear to my why we use them inconsistently - we clearly copied it from the warnings module since it escapes |
#2598 introduced this - it seems like a mistake |
Link to the current commit for future posterity. |
@Asday wrong commit - the pr got the right one however |
Fixed by #3931 |
I'd like to silence the warnings for a specific test which currently raises warnings about naive DateTimes in Django. The reason is because the test is creating noise which I don't have time to fix the underlying cause of.
My initial idea was to silence the warning, leave a comment explaining the silencing, and a comment in the offending code as a TODO.
I've run into issues, as I'd like to specifically ignore the warning about naive DateTimes. If other warnings turn up in the future, I want to see them.
From what I'm understand,
pytest.mark.filterwarnings()
takes a single string argument, which it splits on colons, escapes aggressively, and passes the results towarnings.filterwarnings()
.My question is why is the escaping happening? My warning is as follows:
My
.filterwarnings()
mark is as follows:The arguments that make it through to
warnings.filterwarnings()
are:The
message
isre.compile()
d inwarnings.filterwarnings()
, and that's what I'd like to leverage, but it appearspytest.mark.filterwarnings()
has other ideas. Is there a reason for this? How do I get around this?Pip list:
pytest version 3.7.1. Operating system Linux Mint 18.
The text was updated successfully, but these errors were encountered: