Skip to content

Commit 8a40fc5

Browse files
authored
PytestReturnNotNoneWarning now subclasses PytestRemovedIn8Warning (#10196)
As discussed in #9956 (comment). Also added PytestRemovedIn8Warning to the reference docs.
1 parent 196f019 commit 8a40fc5

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

changelog/10196.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:class:`~pytest.PytestReturnNotNoneWarning` is now a subclass of :class:`~pytest.PytestRemovedIn8Warning`: the plan is to make returning non-``None`` from tests an error in the future.

doc/en/reference/reference.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,9 @@ Custom warnings generated in some situations such as improper usage or deprecate
11361136
.. autoclass:: pytest.PytestReturnNotNoneWarning
11371137
:show-inheritance:
11381138

1139+
.. autoclass:: pytest.PytestRemovedIn8Warning
1140+
:show-inheritance:
1141+
11391142
.. autoclass:: pytest.PytestUnhandledCoroutineWarning
11401143
:show-inheritance:
11411144

src/_pytest/warning_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,13 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
5151
__module__ = "pytest"
5252

5353

54-
@final
5554
class PytestRemovedIn8Warning(PytestDeprecationWarning):
5655
"""Warning class for features that will be removed in pytest 8."""
5756

5857
__module__ = "pytest"
5958

6059

61-
class PytestReturnNotNoneWarning(PytestDeprecationWarning):
60+
class PytestReturnNotNoneWarning(PytestRemovedIn8Warning):
6261
"""Warning emitted when a test function is returning value other than None."""
6362

6463
__module__ = "pytest"

0 commit comments

Comments
 (0)