[IMP] always print a recap of found test modules before running the tests
bzr revid: xmo@openerp.com-20131106130743-xpy9i34b5xceo8ee
This commit is contained in:
parent
6906d24e17
commit
4abde33785
|
@ -63,8 +63,8 @@ def get_test_modules(module, submodule, explode):
|
||||||
ms = submodules
|
ms = submodules
|
||||||
elif submodule == '__fast_suite__':
|
elif submodule == '__fast_suite__':
|
||||||
# `suite` was used before the 6.1 release instead of `fast_suite`.
|
# `suite` was used before the 6.1 release instead of `fast_suite`.
|
||||||
ms = fast_suite if fast_suite else getattr(m, 'suite', None)
|
ms = fast_suite if hasattr(m, 'fast_suite') else getattr(m, 'suite', None)
|
||||||
if ms is None:
|
if not ms:
|
||||||
if explode:
|
if explode:
|
||||||
print 'The module `%s` has no defined test suite.' % (module,)
|
print 'The module `%s` has no defined test suite.' % (module,)
|
||||||
show_submodules_and_exit()
|
show_submodules_and_exit()
|
||||||
|
@ -72,7 +72,7 @@ def get_test_modules(module, submodule, explode):
|
||||||
ms = []
|
ms = []
|
||||||
elif submodule == '__sanity_checks__':
|
elif submodule == '__sanity_checks__':
|
||||||
ms = checks
|
ms = checks
|
||||||
if ms is None:
|
if not ms:
|
||||||
if explode:
|
if explode:
|
||||||
print 'The module `%s` has no defined sanity checks.' % (module,)
|
print 'The module `%s` has no defined sanity checks.' % (module,)
|
||||||
show_submodules_and_exit()
|
show_submodules_and_exit()
|
||||||
|
@ -135,7 +135,11 @@ def run(args):
|
||||||
else:
|
else:
|
||||||
test_modules = get_test_modules(module, submodule, explode=True)
|
test_modules = get_test_modules(module, submodule, explode=True)
|
||||||
|
|
||||||
# Run the test suite.
|
print 'Test modules:'
|
||||||
|
for test_module in test_modules:
|
||||||
|
print ' ', test_module.__name__
|
||||||
|
print
|
||||||
|
|
||||||
if not args.dry_run:
|
if not args.dry_run:
|
||||||
suite = unittest2.TestSuite()
|
suite = unittest2.TestSuite()
|
||||||
for test_module in test_modules:
|
for test_module in test_modules:
|
||||||
|
@ -143,10 +147,6 @@ def run(args):
|
||||||
r = unittest2.TextTestRunner(verbosity=2).run(suite)
|
r = unittest2.TextTestRunner(verbosity=2).run(suite)
|
||||||
if r.errors or r.failures:
|
if r.errors or r.failures:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
|
||||||
print 'Test modules:'
|
|
||||||
for test_module in test_modules:
|
|
||||||
print ' ', test_module.__name__
|
|
||||||
|
|
||||||
def add_parser(subparsers):
|
def add_parser(subparsers):
|
||||||
parser = subparsers.add_parser('run-tests',
|
parser = subparsers.add_parser('run-tests',
|
||||||
|
|
Loading…
Reference in New Issue