Commit e8f3ae69 authored by jvoisin's avatar jvoisin
Browse files

Enhance the way test.py reports failed tests

parent cbf8a2a6
......@@ -93,14 +93,13 @@ class TestFileAttributes(unittest.TestCase):
self.assertEqual(stdout.strip('\n'), 'Unable to pocess %s' % 'ilikecookies')
def main():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestRemovecli))
suite.addTest(unittest.makeSuite(TestListcli))
suite.addTest(unittest.makeSuite(TestisCleancli))
test_result = unittest.TextTestRunner(verbosity=test.VERBOSITY).run(suite)
return len(test_result.failures)
def get_tests():
Suite = unittest.TestSuite()
Suite.addTest(unittest.makeSuite(TestRemovecli))
Suite.addTest(unittest.makeSuite(TestListcli))
Suite.addTest(unittest.makeSuite(TestisCleancli))
return Suite
if __name__ == '__main__':
sys.exit(main())
unittest.TextTestRunner(verbosity=test.VERBOSITY).run(get_tests())
......@@ -78,15 +78,14 @@ class TestFileAttributes(unittest.TestCase):
self.assertFalse(mat.create_class_file('ilikecookies', False, True))
def main():
def get_tests():
Suite = unittest.TestSuite()
Suite.addTest(unittest.makeSuite(TestRemovelib))
Suite.addTest(unittest.makeSuite(TestListlib))
Suite.addTest(unittest.makeSuite(TestisCleanlib))
Suite.addTest(unittest.makeSuite(TestFileAttributes))
test_result = unittest.TextTestRunner(verbosity=test.VERBOSITY).run(Suite)
return len(test_result.failures)
return Suite
if __name__ == '__main__':
sys.exit(main())
unittest.TextTestRunner(verbosity=test.VERBOSITY).run(get_tests())
......@@ -15,6 +15,7 @@ import tempfile
import unittest
import subprocess
import sys
import test
VERBOSITY = 3
......@@ -72,14 +73,12 @@ def main():
import clitest
import libtest
failed_tests = 0
Suite = unittest.TestSuite()
Suite.addTests(clitest.get_tests())
Suite.addTests(libtest.get_tests())
unittest.TextTestRunner(verbosity=test.VERBOSITY).run(Suite)
print('Running cli related tests:\n')
failed_tests += clitest.main()
print('\nRunning library related tests:\n')
failed_tests += libtest.main()
print('\nTotal failed tests: ' + str(failed_tests))
return failed_tests
if __name__ == '__main__':
sys.exit(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