Skip to content

Commit

Permalink
fix pytest-dev#571: deprecate pytest_collect_directory as its missali…
Browse files Browse the repository at this point in the history
…gned since 2010
  • Loading branch information
RonnyPfannschmidt committed Mar 1, 2020
1 parent 5fc80d8 commit 933f302
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/571.deprecation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecate he unused/broken `pytest_collect_directory` hook.
5 changes: 5 additions & 0 deletions src/_pytest/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@
"--no-print-logs is deprecated and scheduled for removal in pytest 6.0.\n"
"Please use --show-capture instead."
)

COLLECT_DIRECTORY_HOOK = PytestDeprecationWarning(
"the pytest_collect_directory was intended to be deprecated since 2014\n"
"as it's missaligned since the removal of Directory as collector in 2010"
)
3 changes: 2 additions & 1 deletion src/_pytest/hookspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from pluggy import HookspecMarker

from .deprecated import COLLECT_DIRECTORY_HOOK
from _pytest.compat import TYPE_CHECKING

if TYPE_CHECKING:
Expand Down Expand Up @@ -205,7 +206,7 @@ def pytest_ignore_collect(path, config):
"""


@hookspec(firstresult=True)
@hookspec(firstresult=True, warn_on_impl=COLLECT_DIRECTORY_HOOK)
def pytest_collect_directory(path, parent):
""" called before traversing a directory for collection files.
Expand Down

0 comments on commit 933f302

Please sign in to comment.