]> git.decadent.org.uk Git - dak.git/commitdiff
Add a basic test runner.
authorChris Lamb <lamby@debian.org>
Sun, 9 Aug 2009 12:07:50 +0000 (13:07 +0100)
committerChris Lamb <lamby@debian.org>
Sun, 9 Aug 2009 12:07:50 +0000 (13:07 +0100)
tests/test_all.py [new file with mode: 0755]

diff --git a/tests/test_all.py b/tests/test_all.py
new file mode 100755 (executable)
index 0000000..32e58ab
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import unittest
+
+def suite():
+    suite = unittest.TestSuite()
+    for _, _, files in os.walk('.'):
+        for name in filter(is_test, files):
+            tests = unittest.defaultTestLoader.loadTestsFromName(name[:-3])
+            suite.addTests(tests)
+    return suite
+
+def is_test(filename):
+    return filename.startswith('test_') and filename.endswith('.py')
+
+if __name__ == "__main__":
+    unittest.main(defaultTest="suite")