From 16b4f5454565ba9419a49e7891655119a8d7e04e Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 26 May 2011 20:00:29 -0500 Subject: [PATCH] remove module before/after import hooks --- _pytest/hookspec.py | 6 ------ _pytest/python.py | 6 +----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/_pytest/hookspec.py b/_pytest/hookspec.py index 99ae77d55..a3f79fd01 100644 --- a/_pytest/hookspec.py +++ b/_pytest/hookspec.py @@ -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 diff --git a/_pytest/python.py b/_pytest/python.py index 9402d93d0..2b47476c9 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -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"))