summaryrefslogtreecommitdiffstats
path: root/nova/test.py
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2012-02-03 00:50:58 +0000
committerMark McLoughlin <markmc@redhat.com>2012-02-10 06:31:56 +0000
commitd1888a3359345acffd8d0845c137eefd88072112 (patch)
tree9fc7502d4feefa603dbf7435b6f11599b255bcc1 /nova/test.py
parent5ad971810aaedcf5c9efd1b56add0e23921899ae (diff)
downloadnova-d1888a3359345acffd8d0845c137eefd88072112.tar.gz
nova-d1888a3359345acffd8d0845c137eefd88072112.tar.xz
nova-d1888a3359345acffd8d0845c137eefd88072112.zip
Remove the last of the gflags shim layer
Make FLAGS a ConfigOpts instance and fix up all the places where we expected FlagValues behaviour. Change-Id: I8f96f42e0d8d30ba6b362d29861e717cf0fa9e89
Diffstat (limited to 'nova/test.py')
-rw-r--r--nova/test.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/nova/test.py b/nova/test.py
index 7fe4b4abb..1bb46c97b 100644
--- a/nova/test.py
+++ b/nova/test.py
@@ -53,7 +53,7 @@ test_opts = [
]
FLAGS = flags.FLAGS
-FLAGS.add_options(test_opts)
+FLAGS.register_opts(test_opts)
LOG = log.getLogger('nova.tests')
@@ -134,7 +134,7 @@ class TestCase(unittest.TestCase):
self.stubs = stubout.StubOutForTesting()
self.injected = []
self._services = []
- self._original_flags = FLAGS.FlagValuesDict()
+ self._overridden_opts = []
def tearDown(self):
"""Runs after each test method to tear down test environment."""
@@ -176,7 +176,8 @@ class TestCase(unittest.TestCase):
def flags(self, **kw):
"""Override flag variables for a test."""
for k, v in kw.iteritems():
- setattr(FLAGS, k, v)
+ FLAGS.set_override(k, v)
+ self._overridden_opts.append(k)
def reset_flags(self):
"""Resets all flag variables for the test.
@@ -184,9 +185,9 @@ class TestCase(unittest.TestCase):
Runs after each test.
"""
- FLAGS.Reset()
- for k, v in self._original_flags.iteritems():
- setattr(FLAGS, k, v)
+ 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