[GRASS-SVN] r61396 - in grass/trunk/lib/python: pygrass/modules/interface/testsuite pygrass/vector/testsuite temporal/testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 24 19:50:51 PDT 2014
Author: wenzeslaus
Date: 2014-07-24 19:50:51 -0700 (Thu, 24 Jul 2014)
New Revision: 61396
Modified:
grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py
grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_parameter.py
grass/trunk/lib/python/pygrass/vector/testsuite/test_geometry.py
grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py
grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py
grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py
grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py
Log:
testing: use gunittest instead of Python unittest (now key-value summary can be collected)
Modified: grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_modules.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -4,7 +4,7 @@
@author: pietro
"""
-import unittest
+from grass.gunittest import TestCase, test
from grass.script.core import get_commands
from grass.pygrass.modules.interface import Module
@@ -28,9 +28,9 @@
return type.__new__(mcs, name, bases, dict)
-class TestModules(unittest.TestCase):
+class TestModules(TestCase):
__metaclass__ = TestModulesMeta
if __name__ == '__main__':
- unittest.main()
+ test()
Modified: grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_parameter.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_parameter.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/pygrass/modules/interface/testsuite/test_parameter.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -5,7 +5,7 @@
@author: pietro
"""
from __future__ import print_function
-import unittest
+from grass.gunittest import TestCase, test
from grass.pygrass.modules.interface.parameter import Parameter, _check_value
@@ -18,7 +18,7 @@
'all': lambda x: x,
}
-class TestCheckValueFunction(unittest.TestCase):
+class TestCheckValueFunction(TestCase):
def test_single_all(self):
param = Parameter(diz=dict(name='int_number', required='yes',
@@ -272,7 +272,7 @@
_check_value(param, "elevation")
-class TestParameterGetBASH(unittest.TestCase):
+class TestParameterGetBash(TestCase):
def test_single_float_double(self):
for ptype in ('float', 'double'):
param = Parameter(diz=dict(name='number', required='yes',
@@ -342,4 +342,4 @@
_check_value(param, 1)
if __name__ == '__main__':
- unittest.main()
+ test()
Modified: grass/trunk/lib/python/pygrass/vector/testsuite/test_geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/testsuite/test_geometry.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/pygrass/vector/testsuite/test_geometry.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -8,12 +8,14 @@
import unittest
import numpy as np
+from grass.gunittest import TestCase, test
+
import grass.lib.vector as libvect
from grass.pygrass.vector.geometry import Point, Line
-class PointTestCase(unittest.TestCase):
+class PointTestCase(TestCase):
def test_empty_init(self):
"""Test Point()"""
@@ -83,7 +85,7 @@
pass
-class LineTestCase(unittest.TestCase):
+class LineTestCase(TestCase):
def test_len(self):
"""Test __len__ magic method"""
@@ -127,4 +129,4 @@
if __name__ == '__main__':
- unittest.main()
+ test()
Modified: grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/pygrass/vector/testsuite/test_table.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -5,15 +5,14 @@
@author: pietro
"""
import os
-import unittest
import sqlite3
import tempfile as tmp
from string import ascii_letters, digits
from random import choice
-
-
import numpy as np
+from grass.gunittest import TestCase, test
+
from grass.pygrass.vector.table import Table, get_path
@@ -147,7 +146,7 @@
self.cols = None
-class ColumnsTestCase(DBconnection, unittest.TestCase):
+class ColumnsTestCase(DBconnection, TestCase):
def test_check_insert_update_str(self):
"""Check insert_str and update_str attribute of Columns are correct"""
@@ -157,7 +156,7 @@
self.assertEqual(self.cols.update_str, update % self.tname)
-class TableInsertTestCase(DBconnection, unittest.TestCase):
+class TableInsertTestCase(DBconnection, TestCase):
def setUp(self):
"""Create a not empty table instance"""
@@ -192,7 +191,7 @@
self.assertListEqual(vals, cur.fetchall())
-class TableUpdateTestCase(DBconnection, unittest.TestCase):
+class TableUpdateTestCase(DBconnection, TestCase):
def test_update(self):
"""Test Table.update method"""
@@ -206,4 +205,4 @@
if __name__ == '__main__':
- unittest.main()
+ test()
Modified: grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/pygrass/vector/testsuite/test_vector3d.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -4,9 +4,10 @@
@author: pietro
"""
-import unittest
import numpy as np
+from grass.gunittest import TestCase, test
+
from grass.script.core import run_command
from grass.pygrass.vector import VectorTopo
@@ -26,7 +27,7 @@
return x, y
-class VectorTopo3DTestCase(unittest.TestCase):
+class VectorTopo3DTestCase(TestCase):
npoints = 10
tmpname = "tmp_vect3d"
@@ -64,4 +65,4 @@
if __name__ == '__main__':
- unittest.main()
+ test()
Modified: grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -11,12 +11,12 @@
import grass.script
import grass.temporal as tgis
-import unittest
+import grass.gunittest as gunittest
import datetime
-import os
-class TestRegisterFunctions(unittest.TestCase):
+class TestRegisterFunctions(gunittest.TestCase):
+
@classmethod
def setUpClass(cls):
"""!Initiate the temporal GIS and set the region
@@ -79,6 +79,4 @@
grass.script.del_temp_region()
if __name__ == '__main__':
- unittest.main()
-
-
+ gunittest.test()
Modified: grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py 2014-07-25 02:46:38 UTC (rev 61395)
+++ grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py 2014-07-25 02:50:51 UTC (rev 61396)
@@ -11,12 +11,12 @@
import grass.script
import grass.temporal as tgis
-import unittest
+import grass.gunittest as gunittest
import datetime
-import os
-class TestRegisterFunctions(unittest.TestCase):
+class TestRegisterFunctions(gunittest.TestCase):
+
@classmethod
def setUpClass(cls):
"""!Initiate the temporal GIS and set the region
@@ -368,7 +368,6 @@
ret = grass.script.run_command("t.remove", flags="rf", input="A,B,C", quiet=True)
grass.script.del_temp_region()
-if __name__ == '__main__':
- unittest.main()
-
+if __name__ == '__main__':
+ gunittest.test()
More information about the grass-commit
mailing list