MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_mark_regex_escape

Function test_mark_regex_escape

testing/test_warnings.py:327–339  ·  view source on GitHub ↗

@pytest.mark.filterwarnings should not try to escape regex characters (#3936)

(pytester: Pytester)

Source from the content-addressed store, hash-verified

325
326@pytest.mark.filterwarnings("always::UserWarning")
327def test_mark_regex_escape(pytester: Pytester) -> None:
328 """@pytest.mark.filterwarnings should not try to escape regex characters (#3936)"""
329 pytester.makepyfile(
330 r"""
331 import pytest, warnings
332
333 @pytest.mark.filterwarnings(r"ignore:some \(warning\)")
334 def test_foo():
335 warnings.warn(UserWarning("some (warning)"))
336 """
337 )
338 result = pytester.runpytest()
339 assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
340
341
342@pytest.mark.filterwarnings("default::pytest.PytestWarning")

Callers

nothing calls this directly

Calls 3

strMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected