Actual fix for bug 931608.

-x --stop is a nose flag
Provide short term solution to deal with '--hide-elapsed'

Can be tested by adding a assertTrue(False) in a test and running
./run_tests.sh -x

Change-Id: I7357e7cdaa3d6370ed111d6209917a833d084db3
This commit is contained in:
Joe Gordon
2012-02-14 15:38:22 -08:00
parent e7cc87ff3b
commit 18dc874d82

View File

@@ -343,9 +343,10 @@ class NovaTestRunner(core.TextTestRunner):
def run():
flags.FLAGS.register_cli_opt(cfg.BoolOpt('hide-elapsed', default=False))
flags.FLAGS.register_cli_opt(cfg.BoolOpt("stop", short='x', default=False))
argv = flags.FLAGS(sys.argv)
# This is a fix to allow the --hide-elapsed flag while accepting
# arbitrary nosetest flags as well
argv = [x for x in sys.argv if x != '--hide-elapsed']
hide_elapsed = argv != sys.argv
logging.setup()
# If any argument looks like a test name but doesn't have "nova.tests" in
@@ -364,7 +365,7 @@ def run():
runner = NovaTestRunner(stream=c.stream,
verbosity=c.verbosity,
config=c,
show_elapsed=not flags.FLAGS.hide_elapsed)
show_elapsed=not hide_elapsed)
sys.exit(not core.run(config=c, testRunner=runner, argv=argv))