[GRASS-SVN] r60942 - in grass/trunk/lib/python/pygrass/modules/interface: . testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 24 01:20:29 PDT 2014


Author: zarch
Date: 2014-06-24 01:20:29 -0700 (Tue, 24 Jun 2014)
New Revision: 60942

Added:
   grass/trunk/lib/python/pygrass/modules/interface/testsuite/
   grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py
Log:
Add test to read the xml interface of all the GRASS modules

Added: grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py	                        (rev 0)
+++ grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py	2014-06-24 08:20:29 UTC (rev 60942)
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:43:53 2014
+
+ at author: pietro
+"""
+import unittest
+
+from grass.script.core import get_commands
+from grass.pygrass.modules.interface import Module
+
+
+SKIP = []
+
+
+class TestModulesMeta(type):
+    def __new__(mcs, name, bases, dict):
+
+        def gen_test(cmd):
+            def test(self):
+                Module(cmd)
+            return test
+
+        cmds = [c for c in sorted(list(get_commands()[0])) if c not in SKIP]
+        for cmd in cmds:
+            test_name = "test__%s" % cmd.replace('.', '_')
+            dict[test_name] = gen_test(cmd)
+        return type.__new__(mcs, name, bases, dict)
+
+
+class TestModules(unittest.TestCase):
+    __metaclass__ = TestModulesMeta
+
+
+if __name__ == '__main__':
+    unittest.main()


Property changes on: grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py
___________________________________________________________________
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native



More information about the grass-commit mailing list