Skip to content

Commit

Permalink
Remove PytestRemovedIn7Warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech committed Dec 7, 2021
1 parent 0f39f11 commit 9c1494a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
17 changes: 17 additions & 0 deletions 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 <https://docs.pytest.org/en/latest/deprecations.html>`__ in the docs.
7 changes: 0 additions & 7 deletions src/_pytest/warning_types.py
Expand Up @@ -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."""
Expand Down
2 changes: 0 additions & 2 deletions src/_pytest/warnings.py
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/pytest/__init__.py
Expand Up @@ -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
Expand Down Expand Up @@ -125,7 +124,6 @@
"PytestConfigWarning",
"PytestDeprecationWarning",
"PytestExperimentalApiWarning",
"PytestRemovedIn7Warning",
"PytestRemovedIn8Warning",
"Pytester",
"PytestPluginManager",
Expand Down
7 changes: 4 additions & 3 deletions testing/test_warnings.py
Expand Up @@ -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.
Expand All @@ -528,20 +529,20 @@ 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":
pytester.makeini(
"""
[pytest]
filterwarnings =
ignore::pytest.PytestRemovedIn7Warning
ignore::pytest.PytestRemovedIn8Warning
"""
)

args = (
("-Wignore::pytest.PytestRemovedIn7Warning",)
("-Wignore::pytest.PytestRemovedIn8Warning",)
if change_default == "cmdline"
else ()
)
Expand Down

0 comments on commit 9c1494a

Please sign in to comment.