|
|
@@ -0,0 +1,22 @@
|
|
|
+#!/usr/bin/env python
|
|
|
+import os
|
|
|
+import re
|
|
|
+import sys
|
|
|
+import unittest
|
|
|
+
|
|
|
+
|
|
|
+TESTS_DIR = 'tests'
|
|
|
+
|
|
|
+matches = [re.match('^(test_(\w+)).\py$', f) for f in os.listdir(TESTS_DIR)]
|
|
|
+suite = unittest.TestSuite()
|
|
|
+loader = unittest.TestLoader()
|
|
|
+
|
|
|
+for match in filter(None, matches):
|
|
|
+ modulename, testname = match.groups()
|
|
|
+ classname = re.sub('(?:^|_)([a-z])', lambda m: m.group(1).upper(),
|
|
|
+ testname) + 'Test'
|
|
|
+ mod = __import__(TESTS_DIR + '.' + modulename, globals(), locals(),
|
|
|
+ classname)
|
|
|
+ suite.addTests(loader.loadTestsFromTestCase(getattr(mod, classname)))
|
|
|
+
|
|
|
+unittest.TextTestRunner().run(suite)
|