Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/en/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
("py:class", "_pytest.python_api.RaisesContext"),
("py:class", "_pytest.recwarn.WarningsChecker"),
("py:class", "_pytest.reports.BaseReport"),
# Sphinx bugs(?)
("py:class", "RewriteHook"),
# Undocumented third parties
("py:class", "_tracing.TagTracerSub"),
("py:class", "warnings.WarningMessage"),
Expand Down
2 changes: 1 addition & 1 deletion doc/en/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ Custom warnings generated in some situations such as improper usage or deprecate
.. autoclass:: pytest.PytestReturnNotNoneWarning
:show-inheritance:

.. autoclass:: pytest.PytestRemovedIn9Warning
.. autoclass:: pytest.PytestRemovedIn10Warning
:show-inheritance:

.. autoclass:: pytest.PytestUnknownMarkWarning
Expand Down
5 changes: 2 additions & 3 deletions doc/en/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
pluggy>=1.5.0
pygments-pytest>=2.5.0
sphinx-removed-in>=0.2.0
# Pinning to <9.0 due to https://github.com/python-trio/sphinxcontrib-trio/issues/399.
sphinx>=7,<9.0
sphinxcontrib-trio
sphinx>=7
sphinxcontrib-trio>=1.2.0
sphinxcontrib-svg2pdfconverter
furo
sphinxcontrib-towncrier
Expand Down
6 changes: 0 additions & 6 deletions src/_pytest/warning_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
__module__ = "pytest"


class PytestRemovedIn9Warning(PytestDeprecationWarning):
"""Warning class for features that will be removed in pytest 9."""

__module__ = "pytest"


class PytestRemovedIn10Warning(PytestDeprecationWarning):
"""Warning class for features that will be removed in pytest 10."""

Expand Down
3 changes: 2 additions & 1 deletion src/_pytest/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def catch_warnings_for_item(
warnings.filterwarnings("always", category=DeprecationWarning)
warnings.filterwarnings("always", category=PendingDeprecationWarning)

warnings.filterwarnings("error", category=pytest.PytestRemovedIn9Warning)
# To be enabled in pytest 10.0.0.
# warnings.filterwarnings("error", category=pytest.PytestRemovedIn10Warning)

apply_warning_filters(config_filters, cmdline_filters)

Expand Down
2 changes: 0 additions & 2 deletions src/pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import PytestExperimentalApiWarning
from _pytest.warning_types import PytestFDWarning
from _pytest.warning_types import PytestRemovedIn9Warning
from _pytest.warning_types import PytestRemovedIn10Warning
from _pytest.warning_types import PytestReturnNotNoneWarning
from _pytest.warning_types import PytestUnhandledThreadExceptionWarning
Expand Down Expand Up @@ -135,7 +134,6 @@
"PytestExperimentalApiWarning",
"PytestFDWarning",
"PytestPluginManager",
"PytestRemovedIn9Warning",
"PytestRemovedIn10Warning",
"PytestReturnNotNoneWarning",
"PytestUnhandledThreadExceptionWarning",
Expand Down
9 changes: 4 additions & 5 deletions testing/test_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,7 @@ def test_invalid_regex_in_filterwarning(self, pytester: Pytester) -> None:
)


# In 9.1, uncomment below and change RemovedIn9 -> RemovedIn10.
# @pytest.mark.skip("not relevant until pytest 10.0")
@pytest.mark.skip("not relevant until pytest 10.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.
Expand All @@ -575,20 +574,20 @@ def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> No
"""
import warnings, pytest
def test():
warnings.warn(pytest.PytestRemovedIn9Warning("some warning"))
warnings.warn(pytest.PytestRemovedIn10Warning("some warning"))
"""
)
if change_default == "ini":
pytester.makeini(
"""
[pytest]
filterwarnings =
ignore::pytest.PytestRemovedIn9Warning
ignore::pytest.PytestRemovedIn10Warning
"""
)

args = (
("-Wignore::pytest.PytestRemovedIn9Warning",)
("-Wignore::pytest.PytestRemovedIn10Warning",)
if change_default == "cmdline"
else ()
)
Expand Down
Loading