[GRASS-SVN] r65673 - in grass/trunk/scripts/g.extension: . testsuite testsuite/data

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 20 00:56:22 PDT 2015


Author: wenzeslaus
Date: 2015-07-20 00:56:21 -0700 (Mon, 20 Jul 2015)
New Revision: 65673

Added:
   grass/trunk/scripts/g.extension/testsuite/
   grass/trunk/scripts/g.extension/testsuite/data/
   grass/trunk/scripts/g.extension/testsuite/data/modules.xml
   grass/trunk/scripts/g.extension/testsuite/data/toolboxes.xml
   grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py
   grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py
Log:
g.extension: add tests for -l flag

Added: grass/trunk/scripts/g.extension/testsuite/data/modules.xml
===================================================================
--- grass/trunk/scripts/g.extension/testsuite/data/modules.xml	                        (rev 0)
+++ grass/trunk/scripts/g.extension/testsuite/data/modules.xml	2015-07-20 07:56:21 UTC (rev 65673)
@@ -0,0 +1,253 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE task SYSTEM "grass-addons.dtd">
+<addons version="7" revision="65616" date="2015-07-19 17:32:21.164032">
+    <task name="d.frame">
+        <description>Manages display frames on the user's graphics monitor.</description>
+        <keywords>display,graphics,monitors,frame</keywords>
+        <binary>
+            <file>scripts/d.frame</file>
+            <file>docs/man/man1/d.frame.1</file>
+            <file>docs/html/d.frame.html</file>
+            <file>docs/html/d_frame.png</file>
+        </binary>
+    </task>
+    <task name="d.mon2">
+        <description>Starts a graphics display monitor which can be controlled from the command line.</description>
+        <keywords>display,CLI</keywords>
+        <binary>
+            <file>scripts/d.mon2</file>
+            <file>docs/man/man1/d.mon2.1</file>
+            <file>docs/html/d.mon2.html</file>
+        </binary>
+    </task>
+    <task name="g.copyall">
+        <description>Copies all or a filtered subset of files of selected type from another mapset to the current working mapset</description>
+        <keywords>copy,general</keywords>
+        <binary>
+            <file>scripts/g.copyall</file>
+            <file>docs/man/man1/g.copyall.1</file>
+            <file>docs/html/g.copyall.html</file>
+        </binary>
+    </task>
+    <task name="g.isis3mt">
+        <description>Generates an ISIS3 map template file according to the current GRASS coordinate reference system</description>
+        <keywords>coordinates,projection</keywords>
+        <binary>
+            <file>scripts/g.isis3mt</file>
+            <file>docs/man/man1/g.isis3mt.1</file>
+            <file>docs/html/g.isis3mt.html</file>
+        </binary>
+    </task>
+    <task name="g.proj.all">
+        <description>Reprojects raster and vector maps from given location and mapset to current mapset.</description>
+        <keywords>general,projection,transformation</keywords>
+        <binary>
+            <file>scripts/g.proj.all</file>
+            <file>docs/man/man1/g.proj.all.1</file>
+            <file>docs/html/g.proj.all.html</file>
+        </binary>
+    </task>
+    <task name="r.gdd">
+        <description>Makes each output cell value a function of the values assigned to the corresponding cells in the input raster map layers.</description>
+        <keywords>raster,series</keywords>
+        <binary>
+            <file>bin/r.gdd</file>
+            <file>docs/man/man1/r.gdd.1</file>
+            <file>docs/html/r.gdd.html</file>
+        </binary>
+    </task>
+    <task name="r.geomorphon">
+        <description>Calculate geomorphons (terrain forms)and associated geometry using machine vision approach</description>
+        <keywords>Geomorphons,Terrain patterns,Machine vision geomorphometry</keywords>
+        <binary>
+            <file>bin/r.geomorphon</file>
+            <file>docs/man/man1/r.geomorphon.1</file>
+            <file>docs/html/r.geomorphon.html</file>
+            <file>docs/html/geomorphon.png</file>
+            <file>docs/html/legend.png</file>
+        </binary>
+    </task>
+    <task name="r.le.patch">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+        </binary>
+    </task>
+    <task name="r.le.pixel">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+        </binary>
+    </task>
+    <task name="r.traveltime">
+        <description>Estimation of travel times/isochrones. Computes the travel time of surface runoff to an outlet</description>
+        <keywords>raster,hydrology</keywords>
+        <binary>
+            <file>bin/r.traveltime</file>
+            <file>docs/man/man1/r.traveltime.1</file>
+            <file>docs/html/r.traveltime.html</file>
+        </binary>
+    </task>
+    <task name="r.univar2">
+        <description>Calculates univariate statistics from the non-null cells of a raster map.</description>
+        <keywords>raster,statistics,univariate statistics,zonal statistics</keywords>
+        <binary>
+            <file>bin/r.univar2</file>
+            <file>docs/man/man1/r.univar2.1</file>
+            <file>docs/html/r.univar2.html</file>
+        </binary>
+    </task>
+    <task name="v.civil">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+            <file>scripts/v.civil.tools</file>
+            <file>scripts/v.civil.road</file>
+            <file>scripts/v.civil.river</file>
+            <file>scripts/v.civil.topo</file>
+            <file>docs/man/man1/v.civil.road.1</file>
+            <file>docs/man/man1/v.civil.tools.1</file>
+            <file>docs/man/man1/v.civil.topo.1</file>
+            <file>docs/man/man1/v.civil.river.1</file>
+            <file>docs/html/v.civil.tools.html</file>
+            <file>docs/html/vcivilroad_4.png</file>
+            <file>docs/html/vcivilroad_11.png</file>
+            <file>docs/html/vcivilroad_6.png</file>
+            <file>docs/html/vcivilroad_7.png</file>
+            <file>docs/html/vcivilroad_1.png</file>
+            <file>docs/html/v.civil.topo.html</file>
+            <file>docs/html/vcivilroad_5.png</file>
+            <file>docs/html/vcivilroad_10.png</file>
+            <file>docs/html/vcivilroad_13.png</file>
+            <file>docs/html/vcivilroad_9.png</file>
+            <file>docs/html/vcivilroad_8.png</file>
+            <file>docs/html/v.civil.road.html</file>
+            <file>docs/html/v.civil.river.html</file>
+            <file>docs/html/vcivilroad_3.png</file>
+            <file>docs/html/vcivilroad_14.png</file>
+            <file>docs/html/vcivilroad_12.png</file>
+            <file>docs/html/vcivilroad_2.png</file>
+        </binary>
+    </task>
+    <task name="v.class.ml">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+            <file>scripts/v.class.ml</file>
+            <file>etc/v.class.ml/ml_classifiers.py</file>
+            <file>etc/v.class.ml/ml_functions.py</file>
+            <file>etc/v.class.ml/ml_functions.pyc</file>
+            <file>etc/v.class.ml/features.py</file>
+            <file>etc/v.class.ml/ml_classifiers.pyc</file>
+            <file>etc/v.class.ml/sqlite2npy.pyc</file>
+            <file>etc/v.class.ml/sqlite2npy.py</file>
+            <file>etc/v.class.ml/training_extraction.py</file>
+            <file>etc/v.class.ml/npy2table.pyc</file>
+            <file>etc/v.class.ml/training_extraction.pyc</file>
+            <file>etc/v.class.ml/npy2table.py</file>
+            <file>etc/v.class.ml/features.pyc</file>
+        </binary>
+    </task>
+    <task name="v.class.mlpy">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+            <file>scripts/v.class.mlpy</file>
+        </binary>
+    </task>
+    <task name="v.colors2">
+        <description>Sets color rules for features in a vector map using a numeric attribute column.</description>
+        <keywords>vector,color table</keywords>
+        <binary>
+            <file>scripts/v.colors2</file>
+            <file>docs/man/man1/v.colors2.1</file>
+            <file>docs/html/v.colors2.html</file>
+        </binary>
+    </task>
+    <task name="v.delaunay3d">
+        <description>Creates a 3D triangulation from an input vector map containing points or centroids.</description>
+        <keywords>vector,geometry,3D triangulation</keywords>
+        <binary>
+            <file>bin/v.delaunay3d</file>
+            <file>docs/man/man1/v.delaunay3d.1</file>
+            <file>docs/html/v.delaunay3d.html</file>
+        </binary>
+    </task>
+    <task name="v.ellipse">
+        <description>Computes the best-fitting ellipse for given vector data.</description>
+        <keywords>vector,geometry,best-fitting ellipse</keywords>
+        <binary>
+            <file>bin/v.ellipse</file>
+            <file>docs/man/man1/v.ellipse.1</file>
+            <file>docs/html/v.ellipse.html</file>
+            <file>docs/html/v_ellipse.png</file>
+        </binary>
+    </task>
+    <task name="v.in.proj">
+        <description>Import vector data using OGR library and reproject on the fly.</description>
+        <keywords>vector,import,projection</keywords>
+        <binary>
+            <file>scripts/v.in.proj</file>
+            <file>docs/man/man1/v.in.proj.1</file>
+            <file>docs/html/v.in.proj.html</file>
+        </binary>
+    </task>
+    <task name="v.in.redwg">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+        </binary>
+    </task>
+    <task name="v.neighborhoodmatrix">
+        <description>Exports the neighborhood matrix of polygons in a vector map</description>
+        <keywords>vector,neighborhood matrix</keywords>
+        <binary>
+            <file>scripts/v.neighborhoodmatrix</file>
+            <file>docs/man/man1/v.neighborhoodmatrix.1</file>
+            <file>docs/html/v.neighborhoodmatrix.html</file>
+        </binary>
+    </task>
+    <task name="v.transects">
+        <description>Creates transect lines or quadrilateral areas at regular intervals perpendicular to a polyline.</description>
+        <keywords>vector,transect</keywords>
+        <binary>
+            <file>scripts/v.transects</file>
+            <file>docs/man/man1/v.transects.1</file>
+            <file>docs/html/v.transects.html</file>
+            <file>docs/html/vtransect_options2.jpg</file>
+            <file>docs/html/vtransect_options1.jpg</file>
+        </binary>
+    </task>
+    <task name="wx.metadata">
+        <description></description>
+        <keywords></keywords>
+        <binary>
+            <file>scripts/r.info.iso</file>
+            <file>scripts/v.info.iso</file>
+            <file>scripts/g.gui.metadata</file>
+            <file>etc/config/init_md</file>
+            <file>etc/config/keywordConcepts</file>
+            <file>etc/config/keywordThemes</file>
+            <file>etc/config/keywordGroups</file>
+            <file>etc/profiles/temporalProfile.xml</file>
+            <file>etc/profiles/inspireProfile.xml</file>
+            <file>etc/profiles/basicProfile.xml</file>
+            <file>etc/mdlib/editor.pyc</file>
+            <file>etc/mdlib/editor.py</file>
+            <file>etc/mdlib/jinjainfo.py</file>
+            <file>etc/mdlib/mdgrass.py</file>
+            <file>etc/mdlib/mdgrass.pyc</file>
+            <file>etc/mdlib/mdutil.pyc</file>
+            <file>etc/mdlib/mdutil.py</file>
+            <file>etc/mdlib/jinjainfo.pyc</file>
+            <file>etc/pdf/mdpdffactory.py</file>
+            <file>etc/pdf/mdpdftheme.py</file>
+            <file>etc/pdf/mdpdftheme.pyc</file>
+            <file>etc/pdf/mdpdffactory.pyc</file>
+            <file>docs/man/man1/r.info.iso.1</file>
+            <file>docs/man/man1/v.info.iso.1</file>
+            <file>docs/html/r.info.iso.html</file>
+            <file>docs/html/v.info.iso.html</file>
+        </binary>
+    </task>
+</addons>

Added: grass/trunk/scripts/g.extension/testsuite/data/toolboxes.xml
===================================================================
--- grass/trunk/scripts/g.extension/testsuite/data/toolboxes.xml	                        (rev 0)
+++ grass/trunk/scripts/g.extension/testsuite/data/toolboxes.xml	2015-07-20 07:56:21 UTC (rev 65673)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbox SYSTEM "grass-toolbox.dtd">
+<addons version="7">
+  <toolbox name="Hydrology" code="HY">
+    <correlate code="RA" />
+    <task name="r.stream.basins" />
+    <task name="r.stream.channel" />
+    <task name="r.stream.distance" />
+    <task name="r.stream.order" />
+    <task name="r.stream.segment" />
+    <task name="r.stream.slope" />
+    <task name="r.stream.snap" />
+    <task name="r.stream.stats" />
+  </toolbox>
+  <toolbox name="mcda" code="MC">
+    <correlate code="RA" />
+    <task name="r.mcda.ahp" />
+    <task name="r.mcda.roughset" />
+    <task name="r.mcda.input" />
+    <task name="r.mcda.output" />
+  </toolbox>
+</addons>

Added: grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py
===================================================================
--- grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py	                        (rev 0)
+++ grass/trunk/scripts/g.extension/testsuite/test_addons_modules.py	2015-07-20 07:56:21 UTC (rev 65673)
@@ -0,0 +1,61 @@
+"""
+TEST:      test_addons_modules.py
+
+AUTHOR(S): Vaclav Petras <wenzeslaus gmail com>
+
+PURPOSE:   Test for g.extension individual modules/extensions handling
+
+COPYRIGHT: (C) 2015 Vaclav Petras, and by the GRASS Development Team
+
+           This program is free software under the GNU General Public
+           License (>=v2). Read the file COPYING that comes with GRASS
+           for details.
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+
+import os
+
+
+MODULES_OUTPUT = """\
+d.frame
+d.mon2
+g.copyall
+g.isis3mt
+g.proj.all
+r.gdd
+r.geomorphon
+r.le.patch
+r.le.pixel
+r.traveltime
+r.univar2
+v.civil
+v.class.ml
+v.class.mlpy
+v.colors2
+v.delaunay3d
+v.ellipse
+v.in.proj
+v.in.redwg
+v.neighborhoodmatrix
+v.transects
+wx.metadata
+""".replace('\n', os.linesep)
+
+
+class TestModulesMetadata(TestCase):
+
+    url = 'file://' + os.path.abspath('data')
+
+    def test_limits(self):
+        """Test if results is in expected limits"""
+        module = SimpleModule('g.extension', flags='l', svnurl=self.url)
+        self.assertModule(module)
+        stdout = module.outputs.stdout
+        self.assertMultiLineEqual(stdout, MODULES_OUTPUT)
+
+
+if __name__ == '__main__':
+    test()

Added: grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py
===================================================================
--- grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py	                        (rev 0)
+++ grass/trunk/scripts/g.extension/testsuite/test_addons_toolboxes.py	2015-07-20 07:56:21 UTC (rev 65673)
@@ -0,0 +1,52 @@
+"""
+TEST:      test_addons_toolboxes.py
+
+AUTHOR(S): Vaclav Petras <wenzeslaus gmail com>
+
+PURPOSE:   Test for g.extension toolboxes handling
+
+COPYRIGHT: (C) 2015 Vaclav Petras, and by the GRASS Development Team
+
+           This program is free software under the GNU General Public
+           License (>=v2). Read the file COPYING that comes with GRASS
+           for details.
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+from grass.gunittest.gmodules import SimpleModule
+
+import os
+
+FULL_TOOLBOXES_OUTPUT = """\
+Hydrology (HY)
+* r.stream.basins
+* r.stream.channel
+* r.stream.distance
+* r.stream.order
+* r.stream.segment
+* r.stream.slope
+* r.stream.snap
+* r.stream.stats
+mcda (MC)
+* r.mcda.ahp
+* r.mcda.roughset
+* r.mcda.input
+* r.mcda.output
+"""
+
+
+class TestToolboxesMetadata(TestCase):
+
+    url = 'file://' + os.path.abspath('data')
+
+    def test_limits(self):
+        """Test if results is in expected limits"""
+        module = SimpleModule('g.extension', flags='lt', svnurl=self.url)
+        self.assertModule(module)
+        stdout = module.outputs.stdout
+        self.assertLooksLike(stdout, FULL_TOOLBOXES_OUTPUT)
+
+
+if __name__ == '__main__':
+    test()



More information about the grass-commit mailing list