remove module before/after import hooks

This commit is contained in:
Benjamin Peterson 2011-05-26 20:00:29 -05:00
parent abb07fc732
commit 16b4f54545
2 changed files with 1 additions and 11 deletions

View File

@ -107,12 +107,6 @@ pytest_pycollect_makemodule.firstresult = True
def pytest_pycollect_onmodule(mod):
""" Called when a module is collected."""
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

View File

@ -228,13 +228,9 @@ class Module(pytest.File, PyCollectorMixin):
return self._memoizedcall('_obj', self._importtestmodule)
def _importtestmodule(self):
self.ihook.pytest_pycollect_before_module_import(mod=self)
# we assume we are only called once per module
try:
try:
mod = self.fspath.pyimport(ensuresyspath=True)
finally:
self.ihook.pytest_pycollect_after_module_import(mod=self)
mod = self.fspath.pyimport(ensuresyspath=True)
except SyntaxError:
excinfo = py.code.ExceptionInfo()
raise self.CollectError(excinfo.getrepr(style="short"))