def test_filterwarnings_mark(pytester: Pytester, default_config) -> None:
    """Test ``filterwarnings`` mark works and takes precedence over command
    line and ini options."""
    if default_config == "ini":
        pytester.makeini(
            """
            [pytest]
            filterwarnings = always::RuntimeWarning
        """
        )
    pytester.makepyfile(
        """
        import warnings
        import pytest

        @pytest.mark.filterwarnings('ignore::RuntimeWarning')
        def test_ignore_runtime_warning():
            warnings.warn(RuntimeWarning())

        @pytest.mark.filterwarnings('error')
        def test_warning_error():
            warnings.warn(RuntimeWarning())

        def test_show_warning():
            warnings.warn(RuntimeWarning())
    """
    )
    result = pytester.runpytest(
        "-W always::RuntimeWarning" if default_config == "cmdline" else ""
    )
    result.stdout.fnmatch_lines(["*= 1 failed, 2 passed, 1 warning in *"])
Test ``filterwarnings`` mark works and takes precedence over command
    line and ini options.
testing/test_warnings.py