1import os, unittest
2
3class Tests():
4    def suite(self):
5        modules_to_test = []
6        test_dir = os.listdir('.')
7        for test in test_dir:
8            if test.startswith('test') and test.endswith('.py'):
9                modules_to_test.append(test.rstrip('.py'))
10
11        alltests = unittest.TestSuite()
12        for module in map(__import__, modules_to_test):
13            alltests.addTest(unittest.findTestCases(module))
14        return alltests
15
16if __name__ == '__main__':
17    MyTests = Tests()
18    unittest.main(defaultTest='MyTests.suite', verbosity=2)