fix issue78 - now python-level teardown functions are now called even if the setup failed.

Important detail: if the setup raises a Skipped exception, teardown will not be called.  This helps
to avoid breaking setup_module/class that performs a skip - it would otherwise internally
be considered as a "successful" setup in order to have teardown called later.  I guess
it also makes sense to treat Skip specially because it is unlikely a teardown should be
called if a Skip was raised on setup.

In any case, failing setups and teardowns will be reported separately.

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-01-27 12:09:30 +01:00
parent 17bd875444
commit b18ab6e03b
3 changed files with 43 additions and 1 deletions

View File

@@ -249,5 +249,9 @@ class SetupState(object):
break
self._pop_and_teardown()
for col in needed_collectors[len(self.stack):]:
col.setup()
self.stack.append(col)
try:
col.setup()
except Skipped:
self.stack.pop()
raise