Repository: pytest-dev/pytest
File: testing/test_warnings.py (Python)

Code before:
            "ignore::PendingDeprecationWarning",
        )
        assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()

    def test_hidden_by_system(self, pytester: Pytester, monkeypatch) -> None:
        self.create_file(pytester)
        monkeypatch.setenv("PYTHONWARNINGS", "once::UserWarning")
        result = pytester.runpytest_subprocess()
        assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()

    def test_invalid_regex_in_filterwarning(self, pytester: Pytester) -> None:
        self.create_file(pytester)
        pytester.makeini(
            """
                [pytest]
                filterwarnings =
                    ignore::DeprecationWarning:*
            """
        )
        result = pytester.runpytest_subprocess()
        assert result.ret == pytest.ExitCode.USAGE_ERROR
        result.stderr.fnmatch_lines(
            [
                "ERROR: while parsing the following warning configuration:",
                "",
                "  ignore::DeprecationWarning:*",
                "",
                "This error occurred:",
                "",
                "Invalid regex '[*]': nothing to repeat at position 0",
            ]
        )


@pytest.mark.skip("not relevant until pytest 9.0")
@pytest.mark.parametrize("change_default", [None, "ini", "cmdline"])
def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> None:
    """This ensures that PytestRemovedInXWarnings raised by pytest are turned into errors.

    This test should be enabled as part of each major release, and skipped again afterwards
    to ensure our deprecations are turning into warnings as expected.
    """
    pytester.makepyfile(
        """
        import warnings, pytest
        def test():
            warnings.warn(pytest.PytestRemovedIn9Warning("some warning"))
    """
    )
    if change_default == "ini":
        pytester.makeini(

Review comment (suggestion):
```suggestion
                "  ignore::DeprecationWarning:[*]",
```

Code after:
            "ignore::PendingDeprecationWarning",
        )
        assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()

    def test_hidden_by_system(self, pytester: Pytester, monkeypatch) -> None:
        self.create_file(pytester)
        monkeypatch.setenv("PYTHONWARNINGS", "once::UserWarning")
        result = pytester.runpytest_subprocess()
        assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()

    def test_invalid_regex_in_filterwarning(self, pytester: Pytester) -> None:
        self.create_file(pytester)
        pytester.makeini(
            """
                [pytest]
                filterwarnings =
                    ignore::DeprecationWarning:*
            """
        )
        result = pytester.runpytest_subprocess()
        assert result.ret == pytest.ExitCode.USAGE_ERROR
        result.stderr.fnmatch_lines(
            [
                "ERROR: while parsing the following warning configuration:",
                "",
                "  ignore::DeprecationWarning:[*]",
                "",
                "This error occurred:",
                "",
                "Invalid regex '[*]': nothing to repeat at position 0",
            ]
        )


@pytest.mark.skip("not relevant until pytest 9.0")
@pytest.mark.parametrize("change_default", [None, "ini", "cmdline"])
def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> None:
    """This ensures that PytestRemovedInXWarnings raised by pytest are turned into errors.

    This test should be enabled as part of each major release, and skipped again afterwards
    to ensure our deprecations are turning into warnings as expected.
    """
    pytester.makepyfile(
        """
        import warnings, pytest
        def test():
            warnings.warn(pytest.PytestRemovedIn9Warning("some warning"))
    """
    )
    if change_default == "ini":
        pytester.makeini(