You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2014/12/22 20:27:15 UTC
svn commit: r1647384 - /qpid/dispatch/trunk/tests/system_test.py
Author: aconway
Date: Mon Dec 22 19:27:15 2014
New Revision: 1647384
URL: http://svn.apache.org/r1647384
Log:
NO-JIRA: system_test.py: Clean up after error in setUpClass.
Modified:
qpid/dispatch/trunk/tests/system_test.py
Modified: qpid/dispatch/trunk/tests/system_test.py
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/tests/system_test.py?rev=1647384&r1=1647383&r2=1647384&view=diff
==============================================================================
--- qpid/dispatch/trunk/tests/system_test.py (original)
+++ qpid/dispatch/trunk/tests/system_test.py Mon Dec 22 19:27:15 2014
@@ -342,7 +342,8 @@ class Qdrouterd(Process):
def teardown(self):
if self._management:
- self._management.close()
+ try: self._management.close()
+ except: pass
super(Qdrouterd, self).teardown()
@property
@@ -506,12 +507,18 @@ class Tester(object):
def teardown(self):
"""Clean up (tear-down, stop or close) objects recorded via cleanup()"""
self.cleanup_list.reverse()
+ errors = []
for obj in self.cleanup_list:
- for method in ["teardown", "tearDown", "stop", "close"]:
- cleanup = getattr(obj, method, None)
- if cleanup:
- cleanup()
- break
+ try:
+ for method in ["teardown", "tearDown", "stop", "close"]:
+ cleanup = getattr(obj, method, None)
+ if cleanup:
+ cleanup()
+ break
+ except Exception, e:
+ errors.push(e)
+ assert not errors, "Errors during teardown: %s" % errors
+
def cleanup(self, x):
"""Record object x for clean-up during tear-down.
@@ -586,7 +593,12 @@ class TestCase(unittest.TestCase, Tester
# Hack to support setUpClass on older python.
# If the class has not already been set up, do it now.
if not hasattr(self.__class__, 'tester'):
- self.setUpClass()
+ try:
+ self.setUpClass()
+ except:
+ if hasattr(self.__class__, 'tester'):
+ self.__class__.tester.teardown()
+ raise
Tester.setup(self)
def tearDown(self):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org