Skip to content

Commit 9c1494a

Browse files
committed
Remove PytestRemovedIn7Warning
Fix pytest-dev#8838.
1 parent 0f39f11 commit 9c1494a

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

changelog/8838.removal.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
As per our policy, the following features have been deprecated in the 6.X series and are now
2+
removed:
3+
4+
* ``pytest._fillfuncargs`` function.
5+
6+
* ``pytest_warning_captured`` hook - use ``pytest_warning_recorded`` instead.
7+
8+
* ``message`` parameter of ``pytest.raises``.
9+
10+
* ``-k -foobar`` syntax - use ``-k 'not foobar'`` instead.
11+
12+
* ``-k foobar:`` syntax.
13+
14+
* ``pytest.collect`` module.
15+
16+
For more information consult
17+
`Deprecations and Removals <https://docs.pytest.org/en/latest/deprecations.html>`__ in the docs.

src/_pytest/warning_types.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ class PytestDeprecationWarning(PytestWarning, DeprecationWarning):
4848
__module__ = "pytest"
4949

5050

51-
@final
52-
class PytestRemovedIn7Warning(PytestDeprecationWarning):
53-
"""Warning class for features that will be removed in pytest 7."""
54-
55-
__module__ = "pytest"
56-
57-
5851
@final
5952
class PytestRemovedIn8Warning(PytestDeprecationWarning):
6053
"""Warning class for features that will be removed in pytest 8."""

src/_pytest/warnings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ def catch_warnings_for_item(
4949
warnings.filterwarnings("always", category=DeprecationWarning)
5050
warnings.filterwarnings("always", category=PendingDeprecationWarning)
5151

52-
warnings.filterwarnings("error", category=pytest.PytestRemovedIn7Warning)
53-
5452
apply_warning_filters(config_filters, cmdline_filters)
5553

5654
# apply filters from "filterwarnings" marks

src/pytest/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
from _pytest.warning_types import PytestConfigWarning
6767
from _pytest.warning_types import PytestDeprecationWarning
6868
from _pytest.warning_types import PytestExperimentalApiWarning
69-
from _pytest.warning_types import PytestRemovedIn7Warning
7069
from _pytest.warning_types import PytestRemovedIn8Warning
7170
from _pytest.warning_types import PytestUnhandledCoroutineWarning
7271
from _pytest.warning_types import PytestUnhandledThreadExceptionWarning
@@ -125,7 +124,6 @@
125124
"PytestConfigWarning",
126125
"PytestDeprecationWarning",
127126
"PytestExperimentalApiWarning",
128-
"PytestRemovedIn7Warning",
129127
"PytestRemovedIn8Warning",
130128
"Pytester",
131129
"PytestPluginManager",

testing/test_warnings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def test_hidden_by_system(self, pytester: Pytester, monkeypatch) -> None:
517517
assert WARNINGS_SUMMARY_HEADER not in result.stdout.str()
518518

519519

520+
@pytest.mark.skip("not relevant until pytest 8.0")
520521
@pytest.mark.parametrize("change_default", [None, "ini", "cmdline"])
521522
def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> None:
522523
"""This ensures that PytestRemovedInXWarnings raised by pytest are turned into errors.
@@ -528,20 +529,20 @@ def test_removed_in_x_warning_as_error(pytester: Pytester, change_default) -> No
528529
"""
529530
import warnings, pytest
530531
def test():
531-
warnings.warn(pytest.PytestRemovedIn7Warning("some warning"))
532+
warnings.warn(pytest.PytestRemovedIn8Warning("some warning"))
532533
"""
533534
)
534535
if change_default == "ini":
535536
pytester.makeini(
536537
"""
537538
[pytest]
538539
filterwarnings =
539-
ignore::pytest.PytestRemovedIn7Warning
540+
ignore::pytest.PytestRemovedIn8Warning
540541
"""
541542
)
542543

543544
args = (
544-
("-Wignore::pytest.PytestRemovedIn7Warning",)
545+
("-Wignore::pytest.PytestRemovedIn8Warning",)
545546
if change_default == "cmdline"
546547
else ()
547548
)

0 commit comments

Comments
 (0)