Skip to content

Commit abfcfb5

Browse files
committed
WIP install::collect_dependencies: report on additional collected items
FIXME: `pytest_collectreport` makes its report afterwards not including our additional ones, so we may instead want to get them officially counted
1 parent 5bcdd9b commit abfcfb5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/install/conftest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
def collect_dependencies(config, item, items):
1111
dependencies = list()
1212
markers = item.own_markers
13+
added_count = 0
1314
for marker in markers:
1415
if marker.name != 'dependency':
1516
continue
@@ -37,14 +38,19 @@ def collect_dependencies(config, item, items):
3738
if depend_nodeid not in list_of_items_nodeid:
3839
item_to_add = pytest.Function.from_parent(name=depend_func, parent=depend_parent)
3940
items.insert(0, item_to_add)
41+
added_count += 1
4042
# recursive look for dependencies into item_to_add
41-
collect_dependencies(config, item_to_add, items)
42-
return
43+
added_count += collect_dependencies(config, item_to_add, items)
44+
return added_count
45+
46+
return 0
4347

4448
# #@pytest.hookimpl(trylast=True)
4549
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:
50+
added_count = 0
4651
for item in items:
47-
collect_dependencies(config, item, items)
52+
added_count += collect_dependencies(config, item, items)
53+
print(f"collected {added_count} additional items")
4854

4955
@pytest.fixture(scope='function')
5056
def answerfile(request):

0 commit comments

Comments
 (0)