From: Yuriy Taraday Date: Tue, 28 May 2013 12:44:51 +0000 (+0400) Subject: Unset all stubs before running other cleanups. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8d7703c86baac6636377bb94e352fca018b1ddd8;p=openstack-build%2Fcinder-build.git Unset all stubs before running other cleanups. 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 --- diff --git a/cinder/test.py b/cinder/test.py index 4db727c9c..e731b6323 100644 --- a/cinder/test.py +++ b/cinder/test.py @@ -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."""