Commit a4f271f5 authored by jvoisin's avatar jvoisin
Browse files

Improve modularity for testsuite

The test.py file now launch all testsuites.
All testsuites now have a main() function
parent ae116901
......@@ -94,11 +94,15 @@ class TestFileAttributes(unittest.TestCase):
stdout, _ = proc.communicate()
self.assertEqual(stdout.strip('\n'), 'Unable to pocess %s' % 'ilikecookies')
if __name__ == '__main__':
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)
sys.exit(len(test_result.failures))
return len(test_result.failures)
if __name__ == '__main__':
sys.exit(main())
......@@ -77,12 +77,16 @@ class TestFileAttributes(unittest.TestCase):
def test_not_exist(self):
self.assertFalse(mat.create_class_file('ilikecookies', False, True))
if __name__ == '__main__':
def main():
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)
sys.exit(len(test_result.failures))
return len(test_result.failures)
if __name__ == '__main__':
sys.exit(main())
......@@ -11,6 +11,7 @@ import glob
import tempfile
import unittest
import subprocess
import sys
VERBOSITY = 3
......@@ -60,3 +61,19 @@ class MATTest(unittest.TestCase):
Remove the tmp folder
'''
shutil.rmtree(self.tmpdir)
def main():
import clitest
import libtest
failed_tests = 0
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