]> git.decadent.org.uk Git - dak.git/commitdiff
Add test that imports all dak commands.
authorChris Lamb <lamby@debian.org>
Sun, 1 Nov 2009 10:19:48 +0000 (10:19 +0000)
committerChris Lamb <lamby@debian.org>
Sun, 1 Nov 2009 10:23:46 +0000 (10:23 +0000)
Signed-off-by: Chris Lamb <lamby@debian.org>
tests/test_imports.py [new file with mode: 0755]

diff --git a/tests/test_imports.py b/tests/test_imports.py
new file mode 100755 (executable)
index 0000000..2b35ab0
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+from base_test import DakTestCase, DAK_ROOT_DIR
+
+import glob
+import unittest
+
+from os.path import join, basename, splitext
+
+class ImportTestCase(DakTestCase):
+    for filename in glob.glob(join(DAK_ROOT_DIR, 'dak', '*.py')):
+        cmd, ext = splitext(basename(filename))
+
+        def test_fn(self, cmd=cmd):
+            __import__('dak', fromlist=[cmd])
+
+        locals()['test_importing_%s' % cmd] = test_fn
+
+if __name__ == '__main__':
+    unittest.main()