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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user