Commit f53d916e authored by Jérome Perrin's avatar Jérome Perrin

propagate verbosity argument to unittest.TestRunner


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17475 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b531efe6
...@@ -171,8 +171,8 @@ class ERP5TypeTestLoader(unittest.TestLoader): ...@@ -171,8 +171,8 @@ class ERP5TypeTestLoader(unittest.TestLoader):
return module.test_suite() return module.test_suite()
return unittest.TestLoader.loadTestsFromModule(self, module) return unittest.TestLoader.loadTestsFromModule(self, module)
def runUnitTestList(test_list): def runUnitTestList(test_list, verbosity=1):
if len(test_list) == 0 : if not test_list:
print "No test to run, exiting immediately." print "No test to run, exiting immediately."
return return
os.environ['INSTANCE_HOME'] = instance_home os.environ['INSTANCE_HOME'] = instance_home
...@@ -268,7 +268,7 @@ def runUnitTestList(test_list): ...@@ -268,7 +268,7 @@ def runUnitTestList(test_list):
# change current directory to the test home, to create zLOG.log in this dir. # change current directory to the test home, to create zLOG.log in this dir.
os.chdir(tests_home) os.chdir(tests_home)
return TestRunner().run(suite) return TestRunner(verbosity=verbosity).run(suite)
def usage(stream, msg=None): def usage(stream, msg=None):
if msg: if msg:
...@@ -298,10 +298,12 @@ def main(): ...@@ -298,10 +298,12 @@ def main():
os.environ["erp5_tests_bt5_path"] = os.path.join(real_instance_home, 'bt5') os.environ["erp5_tests_bt5_path"] = os.path.join(real_instance_home, 'bt5')
os.environ["erp5_tests_recreate_catalog"] = "0" os.environ["erp5_tests_recreate_catalog"] = "0"
verbosity = 1
for opt, arg in opts: for opt, arg in opts:
if opt in ("-v", "--verbose"): if opt in ("-v", "--verbose"):
os.environ['VERBOSE'] = "1" os.environ['VERBOSE'] = "1"
verbosity = 2
elif opt in ("-h", "--help"): elif opt in ("-h", "--help"):
usage(sys.stdout) usage(sys.stdout)
sys.exit() sys.exit()
...@@ -344,7 +346,7 @@ def main(): ...@@ -344,7 +346,7 @@ def main():
print "No test to run, exiting immediately." print "No test to run, exiting immediately."
sys.exit(1) sys.exit(1)
result = runUnitTestList(test_list=test_list) result = runUnitTestList(test_list=test_list, verbosity=verbosity)
from Testing.ZopeTestCase import profiler from Testing.ZopeTestCase import profiler
profiler.print_stats() profiler.print_stats()
sys.exit(len(result.failures) + len(result.errors)) sys.exit(len(result.failures) + len(result.errors))
......
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