]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Unset all stubs before running other cleanups.
authorYuriy Taraday <yorik.sar@gmail.com>
Tue, 28 May 2013 12:44:51 +0000 (16:44 +0400)
committerYuriy Taraday <yorik.sar@gmail.com>
Wed, 5 Jun 2013 14:26:56 +0000 (18:26 +0400)
Cleanup callbacks are run in reverse order so all stubs unsetting
should be added at the end of the cleanup list.

Fixes bug 1185004

Change-Id: I5ad3ea2cdce663aaeae6b7cc2cb9c5dac9d12435

cinder/test.py

index 4db727c9c00ba34161e27bc356a09718ac2170c5..e731b63230775f004971af246cd6981a116bf78d 100644 (file)
@@ -100,6 +100,7 @@ class TestCase(testtools.TestCase):
         # because it screws with our generators
         self.mox = mox.Mox()
         self.stubs = stubout.StubOutForTesting()
+        self.addCleanup(FLAGS.reset)
         self.addCleanup(self.mox.UnsetStubs)
         self.addCleanup(self.stubs.UnsetAll)
         self.addCleanup(self.stubs.SmartUnsetAll)
@@ -107,7 +108,6 @@ class TestCase(testtools.TestCase):
         self.injected = []
         self._services = []
         FLAGS.set_override('fatal_exception_format_errors', True)
-        self.addCleanup(FLAGS.reset)
 
     def tearDown(self):
         """Runs after each test method to tear down test environment."""