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

filterwarnings mark escapes regular expressions #3936

Closed
nicoddemus opened this Issue Sep 5, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@nicoddemus
Member

nicoddemus commented Sep 5, 2018

The following example should not print any warnings:

import pytest, warnings

@pytest.mark.filterwarnings(r"ignore:some \(warning\)")
def test_foo():
    warnings.warn(UserWarning("some (warning)"))     
λ pytest .tmp\test-warn-regex.py
======================== test session starts ========================
...
collected 1 item

.tmp\test-warn-regex.py .                                      [100%]

========================= warnings summary ==========================
test-warn-regex.py::test_foo
  c:\pytest\.tmp\test-warn-regex.py:6: UserWarning: some (warning)
    warnings.warn(UserWarning("some (warning)"))

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=============== 1 passed, 1 warnings in 0.02 seconds ================

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Sep 5, 2018

@asottile

This comment has been minimized.

Show comment
Hide comment
@asottile

asottile Sep 6, 2018

Member

This seems to be the same issue as #3785 -- though I see the commit attached to this, I'm having a hard time finding the PR? /me confused

Member

asottile commented Sep 6, 2018

This seems to be the same issue as #3785 -- though I see the commit attached to this, I'm having a hard time finding the PR? /me confused

@nicoddemus

This comment has been minimized.

Show comment
Hide comment
@nicoddemus

nicoddemus Sep 6, 2018

Member

My bad, this was solved by #3931. 👍

Member

nicoddemus commented Sep 6, 2018

My bad, this was solved by #3931. 👍

@nicoddemus nicoddemus closed this Sep 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment