diff --git a/changelog/8838.removal.rst b/changelog/8838.removal.rst new file mode 100644 index 00000000000..8c8e3a86514 --- /dev/null +++ b/changelog/8838.removal.rst @@ -0,0 +1,17 @@ +As per our policy, the following features have been deprecated in the 6.X series and are now +removed: + +* ``pytest._fillfuncargs`` function. + +* ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead. + +* ``message`` parameter of ``pytest.raises``. + +* ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead. + +* ``-k foobar:`` syntax. + +* ``pytest.collect`` module. + +For more information consult +`Deprecations and Removals `__ in the docs. diff --git a/src/_pytest/warning_types.py b/src/_pytest/warning_types.py index 2a97a319789..ac79bb53acc 100644 --- a/src/_pytest/warning_types.py +++ b/src/_pytest/warning_types.py @@ -48,13 +48,6 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning): __module__ = "pytest" -@final -class PytestRemovedIn7Warning(PytestDeprecationWarning): - """Warning class for features that will be removed in pytest 7.""" - - __module__ = "pytest" - - @final class PytestRemovedIn8Warning(PytestDeprecationWarning): """Warning class for features that will be removed in pytest 8.""" diff --git a/src/_pytest/warnings.py b/src/_pytest/warnings.py index d5afbfeb64c..154283632cf 100644 --- a/src/_pytest/warnings.py +++ b/src/_pytest/warnings.py @@ -49,8 +49,6 @@ def catch_warnings_for_item( warnings.filterwarnings("always", category=DeprecationWarning) warnings.filterwarnings("always", category=PendingDeprecationWarning) - warnings.filterwarnings("error", category=pytest.PytestRemovedIn7Warning) - apply_warning_filters(config_filters, cmdline_filters) # apply filters from "filterwarnings" marks diff --git a/src/pytest/__init__.py b/src/pytest/__init__.py index beb8eba03a2..9c284ac9615 100644 --- a/src/pytest/__init__.py +++ b/src/pytest/__init__.py @@ -66,7 +66,6 @@ from _pytest.warning_types import PytestConfigWarning from _pytest.warning_types import PytestDeprecationWarning from _pytest.warning_types import PytestExperimentalApiWarning -from _pytest.warning_types import PytestRemovedIn7Warning from _pytest.warning_types import PytestRemovedIn8Warning from _pytest.warning_types import PytestUnhandledCoroutineWarning from _pytest.warning_types import PytestUnhandledThreadExceptionWarning @@ -125,7 +124,6 @@ "PytestConfigWarning", "PytestDeprecationWarning", "PytestExperimentalApiWarning", - "PytestRemovedIn7Warning", "PytestRemovedIn8Warning", "Pytester", "PytestPluginManager", diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 45acb720d1d..3ae9ea33181 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -517,6 +517,7 @@ def test_hidden_by_system(self, pytester: Pytester, monkeypatch) -> None: assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() +@pytest.mark.skip("not relevant until pytest 8.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. @@ -528,7 +529,7 @@ def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> No """ import warnings, pytest def test(): - warnings.warn(pytest.PytestRemovedIn7Warning("some warning")) + warnings.warn(pytest.PytestRemovedIn8Warning("some warning")) """ ) if change_default == "ini": @@ -536,12 +537,12 @@ def test(): """ [pytest] filterwarnings = - ignore::pytest.PytestRemovedIn7Warning + ignore::pytest.PytestRemovedIn8Warning """ ) args = ( - ("-Wignore::pytest.PytestRemovedIn7Warning",) + ("-Wignore::pytest.PytestRemovedIn8Warning",) if change_default == "cmdline" else () )