summaryrefslogtreecommitdiffstats
path: root/nova/test.py
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-05-14 06:49:17 -0400
committerMark McLoughlin <markmc@redhat.com>2012-05-21 21:19:57 +0100
commitb8581083318d887cd23e2d3cb6c1023d77f332d2 (patch)
tree4493c642796cb6e5cb680793e71024289b1f9185 /nova/test.py
parentc1bf456cca88652efef8468e673b12acceea5665 (diff)
Use cfg's new behavior of reset() clearing overrides
Change-Id: Ia363ab3c3c16d4988c2e7f3a73302134698a9b79
Diffstat (limited to 'nova/test.py')
-rw-r--r--nova/test.py18
1 files changed, 5 insertions, 13 deletions
diff --git a/nova/test.py b/nova/test.py
index 4f9c607cb..46ba5e49d 100644
--- a/nova/test.py
+++ b/nova/test.py
@@ -39,6 +39,7 @@ from nova import log as logging
from nova.openstack.common import cfg
from nova import service
from nova import tests
+from nova.tests import fake_flags
from nova import utils
from nova.virt import fake
@@ -125,6 +126,9 @@ class TestCase(unittest.TestCase):
def setUp(self):
"""Run before each test method to initialize test environment."""
super(TestCase, self).setUp()
+
+ fake_flags.set_defaults(FLAGS)
+
# NOTE(vish): We need a better method for creating fixtures for tests
# now that we have some required db setup for the system
# to work properly.
@@ -137,7 +141,6 @@ class TestCase(unittest.TestCase):
self.stubs = stubout.StubOutForTesting()
self.injected = []
self._services = []
- self._overridden_opts = []
def tearDown(self):
"""Runs after each test method to tear down test environment."""
@@ -156,7 +159,7 @@ class TestCase(unittest.TestCase):
nova.image.fake.FakeImageService_reset()
# Reset any overridden flags
- self.reset_flags()
+ FLAGS.reset()
# Stop any timers
for x in self.injected:
@@ -182,17 +185,6 @@ class TestCase(unittest.TestCase):
"""Override flag variables for a test."""
for k, v in kw.iteritems():
FLAGS.set_override(k, v)
- self._overridden_opts.append(k)
-
- def reset_flags(self):
- """Resets all flag variables for the test.
-
- Runs after each test.
-
- """
- for k in self._overridden_opts:
- FLAGS.set_override(k, None)
- self._overridden_opts = []
def start_service(self, name, host=None, **kwargs):
host = host and host or uuid.uuid4().hex