Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/pytest_run_parallel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,20 @@ def pytest_runtestloop(self, session: pytest.Session):

return True

@pytest.hookimpl(trylast=True)
def pytest_itemcollected(self, item):
# This is tryfirst=True because we need our plugin's pytest_collection_finish
# to be called before the terminal plugin's pytest_collection_finish:
#
# - pytest's terminal plugin hooks pytest_collection_finish, which calls
# pytest_report_collectionfinish
# - we hook pytest_report_collectionfinish, assuming _handle_collected_item
# has already been called for all items when pytest_report_collectionfinish
# is called
@pytest.hookimpl(tryfirst=True)
def pytest_collection_finish(self, session):
for item in session.items:
self._handle_collected_item(item)

def _handle_collected_item(self, item):
if not hasattr(item, "obj"):
if not hasattr(item, "_parallel_custom_item"):
warnings.warn(
Expand Down