Skip to content

Commit

Permalink
PytestReturnNotNoneWarning now subclasses PytestRemovedIn8Warning (#1…
Browse files Browse the repository at this point in the history
…0196)

As discussed in #9956 (comment).

Also added PytestRemovedIn8Warning to the reference docs.
  • Loading branch information
graingert authored Oct 9, 2022
1 parent 196f019 commit 8a40fc5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/10196.trivial.rst
Original file line number Diff line number Diff line change
@@ -0,0 +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.
3 changes: 3 additions & 0 deletions doc/en/reference/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1136,6 +1136,9 @@ Custom warnings generated in some situations such as improper usage or deprecate
.. autoclass:: pytest.PytestReturnNotNoneWarning
:show-inheritance:

.. autoclass:: pytest.PytestRemovedIn8Warning
:show-inheritance:

.. autoclass:: pytest.PytestUnhandledCoroutineWarning
:show-inheritance:

Expand Down
3 changes: 1 addition & 2 deletions src/_pytest/warning_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
__module__ = "pytest"


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

__module__ = "pytest"


class PytestReturnNotNoneWarning(PytestDeprecationWarning):
class PytestReturnNotNoneWarning(PytestRemovedIn8Warning):
"""Warning emitted when a test function is returning value other than None."""

__module__ = "pytest"
Expand Down

0 comments on commit 8a40fc5

Please sign in to comment.