Selaa lähdekoodia

r.pack: added test, thanks to Sanjeet Bhatti

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74254 15284696-431f-4ddb-bdfa-cd5b030d7da7
Luca Delucchi 6 vuotta sitten
vanhempi
commit
7ec19b07d6
1 muutettua tiedostoa jossa 43 lisäystä ja 0 poistoa
  1. 43 0
      scripts/r.pack/testsuite/test_r_pack.py

+ 43 - 0
scripts/r.pack/testsuite/test_r_pack.py

@@ -0,0 +1,43 @@
+"""
+Created on Sun Jun 08 10:15:22 2018
+
+@author: Sanjeet Bhatti
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+
+import os
+
+
+class TestRPack(TestCase):
+    """Test r.pack script"""
+
+    mapName = 'aspect'
+    outFile = 'aspect.pack'
+
+    @classmethod
+    def setUpClass(cls):
+        """Create maps in a small region."""
+        cls.use_temp_region()
+        cls.runModule('g.region', raster=cls.mapName, flags='p')
+
+    @classmethod
+    def tearDownClass(cls):
+        """Remove temporary region. Delete output file"""
+        cls.del_temp_region()
+
+        if (os.path.isfile(cls.outFile)):
+            os.remove(cls.outFile)
+
+    def test_r_pack(self):
+        """Create a pack file test"""
+        module = SimpleModule('r.pack', input=self.mapName,
+                              output=self.outFile)
+        self.assertModule(module)
+
+        self.assertFileExists(filename=self.outFile)
+
+if __name__ == '__main__':
+    test()