Closed
Description
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 ================