add a hook called after the inital fs collection

This commit is contained in:
Benjamin Peterson 2011-05-26 18:57:37 -05:00
parent 241ff0b43a
commit 196cece338
2 changed files with 7 additions and 1 deletions

View File

@ -79,6 +79,9 @@ def pytest_collect_file(path, parent):
def pytest_collectstart(collector):
""" collector starts collecting. """
def pytest_after_initial_collect(collector):
""" after the initial file system walk before genitems"""
def pytest_itemcollected(item):
""" we just collected a test item. """

View File

@ -386,7 +386,10 @@ class Session(FSCollector):
self._initialparts.append(parts)
self._initialpaths.add(parts[0])
self.ihook.pytest_collectstart(collector=self)
rep = self.ihook.pytest_make_collect_report(collector=self)
try:
rep = self.ihook.pytest_make_collect_report(collector=self)
finally:
self.ihook.pytest_after_initial_collect(collector=self)
self.ihook.pytest_collectreport(report=rep)
self.trace.root.indent -= 1
if self._notfound: