Sync with latest version of openstack.common.cfg

Changes since last sync:

 - Alphabetize imports in openstack/common/cfg.py
 - make reset() clear defaults and overrides
 - automatically create option groups
 - allow options to be marked as required
 - use a list comprehension instead of map()

Change-Id: I74fac3f66b37ee07bab53bd655c0297f25849979
This commit is contained in:
Mark McLoughlin
2012-05-21 20:52:26 +01:00
parent f2da60f5f7
commit 00644652d1

View File

@@ -36,6 +36,7 @@ class FlagsTestCase(test.TestCase):
super(FlagsTestCase, self).setUp()
self.FLAGS = flags.NovaConfigOpts()
self.global_FLAGS = flags.FLAGS
self.flags(config_file=[])
def test_declare(self):
self.assert_('answer' not in self.global_FLAGS)
@@ -64,7 +65,7 @@ class FlagsTestCase(test.TestCase):
self.assertEqual(self.global_FLAGS.runtime_answer, 54)
def test_long_vs_short_flags(self):
self.global_FLAGS.reset()
self.global_FLAGS.clear()
self.global_FLAGS.register_cli_opt(cfg.StrOpt('duplicate_answer_long',
default='val',
help='desc'))
@@ -74,7 +75,7 @@ class FlagsTestCase(test.TestCase):
self.assert_('duplicate_answer' not in self.global_FLAGS)
self.assert_(self.global_FLAGS.duplicate_answer_long, 60)
self.global_FLAGS.reset()
self.global_FLAGS.clear()
self.global_FLAGS.register_cli_opt(cfg.IntOpt('duplicate_answer',
default=60,
help='desc'))