Skip to content

Commit 793d99d

Browse files
authored
[py] Fix pytest_ignore_collect hook to respect --ignore (#15787)
Fix the `pytest_ignore_collect` hook to respect `--ignore` specified by the user. Returning `False` stops pytest from consulting additional hooks, including its default hooks that are necessary to process `--ignore` option. By returning `True` or `None`, the hook combines files ignored by default with ignores specified by the user.
1 parent 989d249 commit 793d99d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

py/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ def pytest_ignore_collect(collection_path, config):
9090
_drivers = set(drivers).difference(drivers_opt or drivers)
9191
if drivers_opt:
9292
_drivers.add("unit")
93-
return len([d for d in _drivers if d.lower() in collection_path.parts]) > 0
93+
if len([d for d in _drivers if d.lower() in collection_path.parts]) > 0:
94+
return True
95+
return None
9496

9597

9698
def pytest_generate_tests(metafunc):

0 commit comments

Comments
 (0)