Skip to content

Commit 0f39f11

Browse files
committed
Remove deprecated pytest.collect module
1 parent 4a45a5e commit 0f39f11

File tree

5 files changed

+8
-59
lines changed

5 files changed

+8
-59
lines changed

doc/en/deprecations.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,23 @@ The ``yield_fixture`` function/decorator
250250
It has been so for a very long time, so can be search/replaced safely.
251251

252252

253+
Removed Features
254+
----------------
255+
256+
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
257+
an appropriate period of deprecation has passed.
258+
259+
253260
The ``pytest.collect`` module
254261
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255262

256263
.. deprecated:: 6.0
264+
.. versionremoved:: 7.0
257265

258266
The ``pytest.collect`` module is no longer part of the public API, all its names
259267
should now be imported from ``pytest`` directly instead.
260268

261269

262-
Removed Features
263-
----------------
264-
265-
As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
266-
an appropriate period of deprecation has passed.
267-
268270

269271
The ``pytest_warning_captured`` hook
270272
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/_pytest/deprecated.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from warnings import warn
1212

1313
from _pytest.warning_types import PytestDeprecationWarning
14-
from _pytest.warning_types import PytestRemovedIn7Warning
1514
from _pytest.warning_types import PytestRemovedIn8Warning
1615
from _pytest.warning_types import UnformattedWarning
1716

@@ -24,12 +23,6 @@
2423
}
2524

2625

27-
PYTEST_COLLECT_MODULE = UnformattedWarning(
28-
PytestRemovedIn7Warning,
29-
"pytest.collect.{name} was moved to pytest.{name}\n"
30-
"Please update to the new name.",
31-
)
32-
3326
# This can be* removed pytest 8, but it's harmless and common, so no rush to remove.
3427
# * If you're in the future: "could have been".
3528
YIELD_FIXTURE = PytestDeprecationWarning(

src/pytest/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# PYTHON_ARGCOMPLETE_OK
22
"""pytest: unit and functional testing with Python."""
3-
from . import collect
43
from _pytest import __version__
54
from _pytest import version_tuple
65
from _pytest._code import ExceptionInfo
@@ -86,7 +85,6 @@
8685
"CaptureFixture",
8786
"Class",
8887
"cmdline",
89-
"collect",
9088
"Collector",
9189
"CollectReport",
9290
"Config",

src/pytest/collect.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

testing/deprecated_test.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@
1010
from pytest import PytestDeprecationWarning
1111

1212

13-
@pytest.mark.parametrize("attribute", pytest.collect.__all__) # type: ignore
14-
# false positive due to dynamic attribute
15-
def test_pytest_collect_module_deprecated(attribute) -> None:
16-
with pytest.warns(DeprecationWarning, match=attribute):
17-
getattr(pytest.collect, attribute)
18-
19-
2013
@pytest.mark.parametrize("plugin", sorted(deprecated.DEPRECATED_EXTERNAL_PLUGINS))
2114
@pytest.mark.filterwarnings("default")
2215
def test_external_plugins_integrated(pytester: Pytester, plugin) -> None:

0 commit comments

Comments
 (0)