Commit 5423b433 authored by Filippos Giannakos's avatar Filippos Giannakos Committed by Giorgos Korfiatis

Properly handle unittest errors in kamaki tests

* Treat unittest errors as failures so they are not discarded silently.
* Add proper exit code on test failure.
parent ac5c4a42
......@@ -432,6 +432,7 @@ def runTestCase(cls, test_name, args=[], failure_collector=[]):
print('* Test * %s *' % test_name)
r = TextTestRunner(verbosity=2).run(suite)
failure_collector += r.failures
failure_collector += r.errors
return r.testsRun
......@@ -463,6 +464,9 @@ def main(argv):
print('\t%s' % field)
print('\nTotal tests run: %s' % num_of_tests)
print('Total failures: %s' % len(failure_collector))
if len(failure_collector):
from sys import exit
exit(1)
if __name__ == '__main__':
......
......@@ -451,6 +451,7 @@ def runTestCase(cls, test_name, args=[], failure_collector=[]):
suite.addTest(makeSuite(cls))
print('* Test * %s *' % test_name)
r = TextTestRunner(verbosity=2).run(suite)
failure_collector += r.errors
failure_collector += r.failures
return r.testsRun
......@@ -489,6 +490,9 @@ def main(argv):
print('\t%s' % field)
print('\nTotal tests run: %s' % num_of_tests)
print('Total failures: %s' % len(failure_collector))
if len(failure_collector):
from sys import exit
exit(1)
if __name__ == '__main__':
......
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