def test_mark_regex_escape(pytester: Pytester) -> None:
    """@pytest.mark.filterwarnings should not try to escape regex characters (#3936)"""
    pytester.makepyfile(
        r"""
        import pytest, warnings

        @pytest.mark.filterwarnings(r"ignore:some \(warning\)")
        def test_foo():
            warnings.warn(UserWarning("some (warning)"))
    """
    )
    result = pytester.runpytest()
    assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
@pytest.mark.filterwarnings should not try to escape regex characters (#3936)
testing/test_warnings.py