expand try/except/finally which py2.4 does't like
This commit is contained in:
parent
c0910abf2f
commit
e02d22aa4f
|
@ -227,8 +227,11 @@ class Module(pytest.File, PyCollectorMixin):
|
||||||
def _importtestmodule(self):
|
def _importtestmodule(self):
|
||||||
self.ihook.pytest_pycollect_before_module_import(mod=self)
|
self.ihook.pytest_pycollect_before_module_import(mod=self)
|
||||||
# we assume we are only called once per module
|
# we assume we are only called once per module
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
mod = self.fspath.pyimport(ensuresyspath=True)
|
mod = self.fspath.pyimport(ensuresyspath=True)
|
||||||
|
finally:
|
||||||
|
self.ihook.pytest_pycollect_after_module_import(mod=self)
|
||||||
except SyntaxError:
|
except SyntaxError:
|
||||||
excinfo = py.code.ExceptionInfo()
|
excinfo = py.code.ExceptionInfo()
|
||||||
raise self.CollectError(excinfo.getrepr(style="short"))
|
raise self.CollectError(excinfo.getrepr(style="short"))
|
||||||
|
@ -243,8 +246,6 @@ class Module(pytest.File, PyCollectorMixin):
|
||||||
"HINT: use a unique basename for your test file modules"
|
"HINT: use a unique basename for your test file modules"
|
||||||
% e.args
|
% e.args
|
||||||
)
|
)
|
||||||
finally:
|
|
||||||
self.ihook.pytest_pycollect_after_module_import(mod=self)
|
|
||||||
#print "imported test module", mod
|
#print "imported test module", mod
|
||||||
self.config.pluginmanager.consider_module(mod)
|
self.config.pluginmanager.consider_module(mod)
|
||||||
return mod
|
return mod
|
||||||
|
|
Loading…
Reference in New Issue