diff options
author | Mark McLoughlin <markmc@redhat.com> | 2012-02-03 00:50:58 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2012-02-10 06:31:56 +0000 |
commit | d1888a3359345acffd8d0845c137eefd88072112 (patch) | |
tree | 9fc7502d4feefa603dbf7435b6f11599b255bcc1 /nova/testing | |
parent | 5ad971810aaedcf5c9efd1b56add0e23921899ae (diff) | |
download | nova-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/testing')
-rw-r--r-- | nova/testing/runner.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/nova/testing/runner.py b/nova/testing/runner.py index 5939fba84..2f40befb0 100644 --- a/nova/testing/runner.py +++ b/nova/testing/runner.py @@ -73,7 +73,9 @@ reldir = os.path.join(os.path.dirname(__file__), '..', '..') absdir = os.path.abspath(reldir) sys.path.insert(0, absdir) +from nova import flags from nova import log as logging +from nova.openstack.common import cfg class _AnsiColorizer(object): @@ -341,18 +343,15 @@ class NovaTestRunner(core.TextTestRunner): def run(): + flags.FLAGS.register_cli_opt(cfg.BoolOpt('hide-elapsed', default=False)) + argv = flags.FLAGS(sys.argv) logging.setup() + # If any argument looks like a test name but doesn't have "nova.tests" in # front of it, automatically add that so we don't have to type as much - show_elapsed = True - argv = [] - for x in sys.argv: - if x.startswith('test_'): - argv.append('nova.tests.%s' % x) - elif x.startswith('--hide-elapsed'): - show_elapsed = False - else: - argv.append(x) + for i, arg in enumerate(argv): + if arg.startswith('test_'): + argv[i] = append('nova.tests.%s' % arg) testdir = os.path.abspath(os.path.join("nova", "tests")) c = config.Config(stream=sys.stdout, @@ -364,7 +363,7 @@ def run(): runner = NovaTestRunner(stream=c.stream, verbosity=c.verbosity, config=c, - show_elapsed=show_elapsed) + show_elapsed=not flags.FLAGS.hide_elapsed) sys.exit(not core.run(config=c, testRunner=runner, argv=argv)) |