Skip to content

Commit

Permalink
Remove deprecated pytest.collect module
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetech committed Dec 7, 2021
1 parent 4a45a5e commit 0f39f11
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 59 deletions.
14 changes: 8 additions & 6 deletions doc/en/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -250,21 +250,23 @@ The ``yield_fixture`` function/decorator
It has been so for a very long time, so can be search/replaced safely.


Removed Features
----------------

As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
an appropriate period of deprecation has passed.


The ``pytest.collect`` module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. deprecated:: 6.0
.. versionremoved:: 7.0

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


Removed Features
----------------

As stated in our :ref:`backwards-compatibility` policy, deprecated features are removed only in major releases after
an appropriate period of deprecation has passed.


The ``pytest_warning_captured`` hook
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
7 changes: 0 additions & 7 deletions src/_pytest/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from warnings import warn

from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import PytestRemovedIn7Warning
from _pytest.warning_types import PytestRemovedIn8Warning
from _pytest.warning_types import UnformattedWarning

Expand All @@ -24,12 +23,6 @@
}


PYTEST_COLLECT_MODULE = UnformattedWarning(
PytestRemovedIn7Warning,
"pytest.collect.{name} was moved to pytest.{name}\n"
"Please update to the new name.",
)

# This can be* removed pytest 8, but it's harmless and common, so no rush to remove.
# * If you're in the future: "could have been".
YIELD_FIXTURE = PytestDeprecationWarning(
Expand Down
2 changes: 0 additions & 2 deletions src/pytest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# PYTHON_ARGCOMPLETE_OK
"""pytest: unit and functional testing with Python."""
from . import collect
from _pytest import __version__
from _pytest import version_tuple
from _pytest._code import ExceptionInfo
Expand Down Expand Up @@ -86,7 +85,6 @@
"CaptureFixture",
"Class",
"cmdline",
"collect",
"Collector",
"CollectReport",
"Config",
Expand Down
37 changes: 0 additions & 37 deletions src/pytest/collect.py

This file was deleted.

7 changes: 0 additions & 7 deletions testing/deprecated_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
from pytest import PytestDeprecationWarning


@pytest.mark.parametrize("attribute", pytest.collect.__all__) # type: ignore
# false positive due to dynamic attribute
def test_pytest_collect_module_deprecated(attribute) -> None:
with pytest.warns(DeprecationWarning, match=attribute):
getattr(pytest.collect, attribute)


@pytest.mark.parametrize("plugin", sorted(deprecated.DEPRECATED_EXTERNAL_PLUGINS))
@pytest.mark.filterwarnings("default")
def test_external_plugins_integrated(pytester: Pytester, plugin) -> None:
Expand Down

0 comments on commit 0f39f11

Please sign in to comment.