Commit 744dbf5f authored by Julien Muchembled's avatar Julien Muchembled

qa: new --loop runner option

parent 00ea89c3
...@@ -229,6 +229,8 @@ class TestRunner(BenchmarkRunner): ...@@ -229,6 +229,8 @@ class TestRunner(BenchmarkRunner):
parser.add_option('-C', '--cov-unit', action='store_true', parser.add_option('-C', '--cov-unit', action='store_true',
help='Same as -c but output 1 file per test,' help='Same as -c but output 1 file per test,'
' in the temporary test directory') ' in the temporary test directory')
parser.add_option('-l', '--loop', type='int', default=1,
help='Repeat tests several times')
parser.add_option('-f', '--functional', action='store_true', parser.add_option('-f', '--functional', action='store_true',
help='Functional tests') help='Functional tests')
parser.add_option('-u', '--unit', action='store_true', parser.add_option('-u', '--unit', action='store_true',
...@@ -271,6 +273,7 @@ Environment Variables: ...@@ -271,6 +273,7 @@ Environment Variables:
sys.exit('Nothing to run, please give one of -f, -u, -z') sys.exit('Nothing to run, please give one of -f, -u, -z')
options.unit = options.functional = options.zodb = True options.unit = options.functional = options.zodb = True
return dict( return dict(
loop = options.loop,
unit = options.unit, unit = options.unit,
functional = options.functional, functional = options.functional,
zodb = options.zodb, zodb = options.zodb,
...@@ -301,12 +304,13 @@ Environment Variables: ...@@ -301,12 +304,13 @@ Environment Variables:
del self.__coverage del self.__coverage
orig(self, success) orig(self, success)
try: try:
if config.unit: for _ in xrange(config.loop):
runner.run('Unit tests', UNIT_TEST_MODULES, only) if config.unit:
if config.functional: runner.run('Unit tests', UNIT_TEST_MODULES, only)
runner.run('Functional tests', FUNC_TEST_MODULES, only) if config.functional:
if config.zodb: runner.run('Functional tests', FUNC_TEST_MODULES, only)
runner.run('ZODB tests', ZODB_TEST_MODULES, only) if config.zodb:
runner.run('ZODB tests', ZODB_TEST_MODULES, only)
except KeyboardInterrupt: except KeyboardInterrupt:
config['mail_to'] = None config['mail_to'] = None
traceback.print_exc() traceback.print_exc()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment