Skip to content

Commit cc03174

Browse files
committed
Fix pytest_ignore_collect hooks: do not return False
It should only return `True` when something is to be ignored, not `False` otherwise typically. This caused e.g. bad interaction with the cacheprovider (before pytest-dev#6448).
1 parent 82f5986 commit cc03174

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/_pytest/hookspec.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ def pytest_ignore_collect(path, config):
198198
This hook is consulted for all files and directories prior to calling
199199
more specific hooks.
200200
201-
Stops at first non-None result, see :ref:`firstresult`
201+
Stops at first non-None result, see :ref:`firstresult`, i.e. you should
202+
only return `False` if the file should never get ignored (by other hooks).
202203
203204
:param path: a :py:class:`py.path.local` - the path to analyze
204205
:param _pytest.config.Config config: pytest config object

src/_pytest/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,6 @@ def pytest_ignore_collect(path, config):
320320
if not allow_in_venv and _in_venv(path):
321321
return True
322322

323-
return False
324-
325323

326324
def pytest_collection_modifyitems(items, config):
327325
deselect_prefixes = tuple(config.getoption("deselect") or [])

0 commit comments

Comments
 (0)