add hooks before and after a module is imported

This commit is contained in:
Benjamin Peterson
2011-05-19 21:45:33 -05:00
parent 78be3db9bb
commit bf039fea74
2 changed files with 9 additions and 0 deletions

View File

@@ -104,6 +104,12 @@ def pytest_pycollect_makemodule(path, parent):
"""
pytest_pycollect_makemodule.firstresult = True
def pytest_pycollect_before_module_import(mod):
"""Called before a module is imported."""
def pytest_pycollect_after_module_import(mod):
"""Called after a module is imported."""
def pytest_pycollect_makeitem(collector, name, obj):
""" return custom item/collector for a python object in a module, or None. """
pytest_pycollect_makeitem.firstresult = True