refine setup ordering some more - test and avoid a problem with funcarg setups where the

surrounding setup_module would fail, but the funcarg setup still be called (which might
assume that setup_module has been called so would raise a confusing error)

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-01-28 15:36:27 +01:00
parent a2af204687
commit 9d64d7e27a
2 changed files with 26 additions and 4 deletions

View File

@@ -248,6 +248,10 @@ class SetupState(object):
if self.stack == needed_collectors[:len(self.stack)]:
break
self._pop_and_teardown()
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)
for col in needed_collectors[len(self.stack):]:
self.stack.append(col)
try:
@@ -255,7 +259,3 @@ class SetupState(object):
except Exception:
col._prepare_exc = sys.exc_info()
raise
# check if the last collection node has raised an error
for col in self.stack:
if hasattr(col, '_prepare_exc'):
py.builtin._reraise(*col._prepare_exc)