Remove `PytestRemovedIn8Warning`

Per our deprecation policy.
This commit is contained in:
Ran Benita 2024-01-02 12:21:08 +02:00
parent 6c89f9261c
commit 215f4d1fab
6 changed files with 7 additions and 18 deletions

View File

@ -227,7 +227,7 @@ These are breaking changes where deprecation was not possible.
Deprecations Deprecations
------------ ------------
- `#10465 <https://github.com/pytest-dev/pytest/issues/10465>`_: Test functions returning a value other than ``None`` will now issue a :class:`pytest.PytestWarning` instead of :class:`pytest.PytestRemovedIn8Warning`, meaning this will stay a warning instead of becoming an error in the future. - `#10465 <https://github.com/pytest-dev/pytest/issues/10465>`_: Test functions returning a value other than ``None`` will now issue a :class:`pytest.PytestWarning` instead of ``pytest.PytestRemovedIn8Warning``, meaning this will stay a warning instead of becoming an error in the future.
- `#3664 <https://github.com/pytest-dev/pytest/issues/3664>`_: Applying a mark to a fixture function now issues a warning: marks in fixtures never had any effect, but it is a common user error to apply a mark to a fixture (for example ``usefixtures``) and expect it to work. - `#3664 <https://github.com/pytest-dev/pytest/issues/3664>`_: Applying a mark to a fixture function now issues a warning: marks in fixtures never had any effect, but it is a common user error to apply a mark to a fixture (for example ``usefixtures``) and expect it to work.

View File

@ -1207,9 +1207,6 @@ Custom warnings generated in some situations such as improper usage or deprecate
.. autoclass:: pytest.PytestReturnNotNoneWarning .. autoclass:: pytest.PytestReturnNotNoneWarning
:show-inheritance: :show-inheritance:
.. autoclass:: pytest.PytestRemovedIn8Warning
:show-inheritance:
.. autoclass:: pytest.PytestRemovedIn9Warning .. autoclass:: pytest.PytestRemovedIn9Warning
:show-inheritance: :show-inheritance:

View File

@ -49,12 +49,6 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
__module__ = "pytest" __module__ = "pytest"
class PytestRemovedIn8Warning(PytestDeprecationWarning):
"""Warning class for features that will be removed in pytest 8."""
__module__ = "pytest"
class PytestRemovedIn9Warning(PytestDeprecationWarning): class PytestRemovedIn9Warning(PytestDeprecationWarning):
"""Warning class for features that will be removed in pytest 9.""" """Warning class for features that will be removed in pytest 9."""

View File

@ -46,7 +46,8 @@ def catch_warnings_for_item(
warnings.filterwarnings("always", category=DeprecationWarning) warnings.filterwarnings("always", category=DeprecationWarning)
warnings.filterwarnings("always", category=PendingDeprecationWarning) warnings.filterwarnings("always", category=PendingDeprecationWarning)
warnings.filterwarnings("error", category=pytest.PytestRemovedIn8Warning) # To be enabled in pytest 9.0.0.
# warnings.filterwarnings("error", category=pytest.PytestRemovedIn9Warning)
apply_warning_filters(config_filters, cmdline_filters) apply_warning_filters(config_filters, cmdline_filters)

View File

@ -73,7 +73,6 @@ from _pytest.warning_types import PytestCollectionWarning
from _pytest.warning_types import PytestConfigWarning from _pytest.warning_types import PytestConfigWarning
from _pytest.warning_types import PytestDeprecationWarning from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import PytestExperimentalApiWarning from _pytest.warning_types import PytestExperimentalApiWarning
from _pytest.warning_types import PytestRemovedIn8Warning
from _pytest.warning_types import PytestRemovedIn9Warning from _pytest.warning_types import PytestRemovedIn9Warning
from _pytest.warning_types import PytestReturnNotNoneWarning from _pytest.warning_types import PytestReturnNotNoneWarning
from _pytest.warning_types import PytestUnhandledCoroutineWarning from _pytest.warning_types import PytestUnhandledCoroutineWarning
@ -137,7 +136,6 @@ __all__ = [
"PytestConfigWarning", "PytestConfigWarning",
"PytestDeprecationWarning", "PytestDeprecationWarning",
"PytestExperimentalApiWarning", "PytestExperimentalApiWarning",
"PytestRemovedIn8Warning",
"PytestRemovedIn9Warning", "PytestRemovedIn9Warning",
"PytestReturnNotNoneWarning", "PytestReturnNotNoneWarning",
"Pytester", "Pytester",

View File

@ -518,8 +518,7 @@ class TestDeprecationWarningsByDefault:
assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
# In 8.1, uncomment below and change RemovedIn8 -> RemovedIn9. @pytest.mark.skip("not relevant until pytest 9.0")
# @pytest.mark.skip("not relevant until pytest 9.0")
@pytest.mark.parametrize("change_default", [None, "ini", "cmdline"]) @pytest.mark.parametrize("change_default", [None, "ini", "cmdline"])
def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> None: 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 ensures that PytestRemovedInXWarnings raised by pytest are turned into errors.
@ -531,7 +530,7 @@ def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> No
""" """
import warnings, pytest import warnings, pytest
def test(): def test():
warnings.warn(pytest.PytestRemovedIn8Warning("some warning")) warnings.warn(pytest.PytestRemovedIn9Warning("some warning"))
""" """
) )
if change_default == "ini": if change_default == "ini":
@ -539,12 +538,12 @@ def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> No
""" """
[pytest] [pytest]
filterwarnings = filterwarnings =
ignore::pytest.PytestRemovedIn8Warning ignore::pytest.PytestRemovedIn9Warning
""" """
) )
args = ( args = (
("-Wignore::pytest.PytestRemovedIn8Warning",) ("-Wignore::pytest.PytestRemovedIn9Warning",)
if change_default == "cmdline" if change_default == "cmdline"
else () else ()
) )