Rev 4317: Scatter a few _runCleanups in TestCase.run in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Fri May 1 04:50:50 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 4317
revision-id: robertc at robertcollins.net-20090501035047-j32bh821vsr7x8pl
parent: robertc at robertcollins.net-20090501011803-hirv7ms95xrhwk26
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Fri 2009-05-01 13:50:47 +1000
message:
  Scatter a few _runCleanups in  TestCase.run
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-05-01 01:18:03 +0000
+++ b/bzrlib/tests/__init__.py	2009-05-01 03:50:47 +0000
@@ -1391,6 +1391,7 @@
                                 "test setUp did not invoke "
                                 "bzrlib.tests.TestCase's setUp")
                     except KeyboardInterrupt:
+                        self._runCleanups()
                         raise
                     except TestSkipped, e:
                         self._do_skip(result, e.args[0])
@@ -1398,6 +1399,7 @@
                         return result
                     except:
                         result.addError(self, sys.exc_info())
+                        self._runCleanups()
                         return result
 
                     ok = False
@@ -1413,6 +1415,7 @@
                             reason = e.args[0]
                         self._do_skip(result, reason)
                     except KeyboardInterrupt:
+                        self._runCleanups()
                         raise
                     except:
                         result.addError(self, sys.exc_info())
@@ -1424,9 +1427,11 @@
                                 "test tearDown did not invoke "
                                 "bzrlib.tests.TestCase's tearDown")
                     except KeyboardInterrupt:
+                        self._runCleanups()
                         raise
                     except:
                         result.addError(self, sys.exc_info())
+                        self._runCleanups()
                         ok = False
                     if ok: result.addSuccess(self)
                 finally:
@@ -1434,8 +1439,10 @@
                 return result
             except TestNotApplicable:
                 # Not moved from the result [yet].
+                self._runCleanups()
                 raise
             except KeyboardInterrupt:
+                self._runCleanups()
                 raise
         finally:
             saved_attrs = {}
@@ -1447,9 +1454,9 @@
             self.__dict__ = saved_attrs
 
     def tearDown(self):
-        self._bzr_test_tearDown_run = True
         self._runCleanups()
         self._log_contents = ''
+        self._bzr_test_tearDown_run = True
         unittest.TestCase.tearDown(self)
 
     def time(self, callable, *args, **kwargs):




More information about the bazaar-commits mailing list