Add toggle to run tests in-process, w/ realtime progress feedback
Change-Id: I4b4d0c24d2718f2902b71d98e9bde3dcefb19c70
This commit is contained in:
parent
95f49529a1
commit
242048ad69
|
@ -91,11 +91,19 @@ class KeystoneTest(object):
|
|||
|
||||
# discover and run tests
|
||||
print "Running tests..."
|
||||
loader = unittest.TestLoader()
|
||||
suite = loader.discover(TEST_DIR, top_level_dir=BASE_DIR)
|
||||
result = unittest.TextTestRunner(verbosity=1).run(suite)
|
||||
if not result.wasSuccessful():
|
||||
raise RuntimeError("%s unresolved issues." %
|
||||
(len(result.errors) + len(result.failures),))
|
||||
if '--with-progress' in sys.argv:
|
||||
loader = unittest.TestLoader()
|
||||
suite = loader.discover(TEST_DIR, top_level_dir=BASE_DIR)
|
||||
result = unittest.TextTestRunner(verbosity=1).run(suite)
|
||||
if not result.wasSuccessful():
|
||||
raise RuntimeError("%s unresolved issues." %
|
||||
(len(result.errors) + len(result.failures),))
|
||||
elif '--with-coverage' in sys.argv:
|
||||
print "running coverage"
|
||||
execute('coverage run %s discover -t %s -s %s' %
|
||||
('/usr/bin/unit2', BASE_DIR, TEST_DIR))
|
||||
else:
|
||||
execute('unit2 discover -f -t %s -s %s' %
|
||||
(BASE_DIR, TEST_DIR))
|
||||
finally:
|
||||
self.tearDown()
|
||||
|
|
|
@ -8,6 +8,10 @@ function usage {
|
|||
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment"
|
||||
echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added."
|
||||
echo " --unittests-only Run unit tests only, exclude functional tests."
|
||||
echo " --with-coverage Runs tests with python code coverage (useful for jenkins)"
|
||||
echo " Note: cannot be used in combination --with-progress"
|
||||
echo " --with-progress Runs tests with progress (useful for developers)"
|
||||
echo " Note: cannot be used in combination --with-coverage"
|
||||
echo " -p, --pep8 Just run pep8"
|
||||
echo " -l, --pylint Just run pylint"
|
||||
echo " -h, --help Print this usage message"
|
||||
|
|
Loading…
Reference in New Issue