瀏覽代碼

gunittest: use empty init file to avoid unnecessary imports in extreme cases

Imports now must be more explicit and longer but they are copy pasted anyway.

Changing all usages to new style. Only doctest test files are using different style.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65204 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 10 年之前
父節點
當前提交
8e65de3dd0
共有 75 個文件被更改,包括 301 次插入249 次删除
  1. 4 3
      general/g.list/testsuite/test_g_list.py
  2. 5 4
      general/g.remove/testsuite/test_g_remove.py
  3. 4 3
      general/g.rename/testsuite/test_overwrite.py
  4. 4 2
      lib/python/docs/src/gunittest_testing.rst
  5. 3 1
      lib/python/exceptions/testsuite/test_ScriptError.py
  6. 2 20
      lib/python/gunittest/__init__.py
  7. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_errors/testsuite/test_error.py
  8. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_errors/testsuite/test_import_error.py
  9. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_gfatalerror.py
  10. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_osexit_one.py
  11. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_osexit_zero.py
  12. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_segfaut.py
  13. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_sysexit_one.py
  14. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_sysexit_zero.py
  15. 2 1
      lib/python/gunittest/testsuite/data/samplecode/submodule_test_fail/testsuite/test_fail.py
  16. 2 1
      lib/python/gunittest/testsuite/data/samplecode/testsuite/test_good_and_bad.py
  17. 2 1
      lib/python/gunittest/testsuite/data/samplecode/testsuite/test_success.py
  18. 8 7
      lib/python/gunittest/testsuite/test_assertions.py
  19. 4 5
      lib/python/gunittest/testsuite/test_assertions_rast3d.py
  20. 5 4
      lib/python/gunittest/testsuite/test_assertions_vect.py
  21. 9 8
      lib/python/gunittest/testsuite/test_checkers.py
  22. 8 4
      lib/python/gunittest/testsuite/test_doctests.py
  23. 4 3
      lib/python/gunittest/testsuite/test_gmodules.py
  24. 5 4
      lib/python/gunittest/testsuite/test_module_assertions.py
  25. 5 4
      lib/python/pygrass/gis/testsuite/test_doctests.py
  26. 3 2
      lib/python/pygrass/gis/testsuite/test_gis.py
  27. 5 4
      lib/python/pygrass/messages/testsuite/test_doctests.py
  28. 5 4
      lib/python/pygrass/modules/grid/testsuite/test_doctests.py
  29. 5 4
      lib/python/pygrass/modules/interface/testsuite/test_doctests.py
  30. 2 1
      lib/python/pygrass/modules/interface/testsuite/test_modules.py
  31. 2 1
      lib/python/pygrass/modules/interface/testsuite/test_parameter.py
  32. 5 4
      lib/python/pygrass/modules/testsuite/test_doctests.py
  33. 2 1
      lib/python/pygrass/raster/testsuite/test_category.py
  34. 5 4
      lib/python/pygrass/raster/testsuite/test_doctests.py
  35. 2 1
      lib/python/pygrass/raster/testsuite/test_history.py
  36. 2 1
      lib/python/pygrass/raster/testsuite/test_raster.py
  37. 5 4
      lib/python/pygrass/shell/testsuite/test_doctests.py
  38. 5 4
      lib/python/pygrass/testsuite/test_doctests.py
  39. 5 4
      lib/python/pygrass/vector/testsuite/test_doctests.py
  40. 2 1
      lib/python/pygrass/vector/testsuite/test_geometry.py
  41. 2 1
      lib/python/pygrass/vector/testsuite/test_table.py
  42. 2 1
      lib/python/pygrass/vector/testsuite/test_vector.py
  43. 2 1
      lib/python/pygrass/vector/testsuite/test_vector3d.py
  44. 5 4
      lib/python/script/testsuite/test_doctests.py
  45. 4 3
      lib/python/script/testsuite/test_start_command_functions.py
  46. 4 3
      lib/python/script/testsuite/test_start_command_functions_nc.py
  47. 8 5
      lib/python/temporal/testsuite/test_doctests.py
  48. 4 3
      lib/python/temporal/testsuite/test_register_function.py
  49. 4 3
      lib/python/temporal/testsuite/unittests_temporal_algebra.py
  50. 4 3
      lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py
  51. 4 3
      lib/python/temporal/testsuite/unittests_temporal_conditionals.py
  52. 6 7
      lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py
  53. 6 5
      lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py
  54. 6 5
      lib/python/temporal/testsuite/unittests_temporal_raster_algebra_grs.py
  55. 6 5
      lib/python/temporal/testsuite/unittests_temporal_raster_conditionals.py
  56. 6 8
      lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py
  57. 4 3
      raster/r.in.poly/testsuite/test_rinpoly.py
  58. 4 3
      raster/r.mapcalc/testsuite/test_r3_mapcalc.py
  59. 5 4
      raster/r.mapcalc/testsuite/test_r_mapcalc.py
  60. 2 1
      raster/r.profile/testsuite/test_profile_ncspm.py
  61. 2 1
      raster/r.recode/testsuite/test_rrecode_ncspm.py
  62. 7 6
      raster/r.slope.aspect/testsuite/test_r_slope_aspect.py
  63. 5 4
      raster/r.viewshed/testsuite/test_r_viewshed.py
  64. 4 3
      raster/r.watershed/testsuite/r_watershed_test.py
  65. 2 1
      raster3d/r3.flow/testsuite/r3flow_test.py
  66. 2 1
      raster3d/r3.gradient/testsuite/r3gradient_test.py
  67. 6 4
      temporal/t.rast.algebra/testsuite/test_raster_algebra.py
  68. 6 7
      temporal/t.rast.algebra/testsuite/test_raster_algebra_fails.py
  69. 6 4
      temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity.py
  70. 6 5
      temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity_fails.py
  71. 6 7
      temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py
  72. 6 7
      temporal/t.vect.algebra/testsuite/test_vector_algebra.py
  73. 4 3
      vector/v.net/testsuite/test_v_net.py
  74. 2 1
      vector/v.what/testsuite/test_vwhat_layers.py
  75. 2 1
      vector/v.what/testsuite/test_vwhat_ncspm.py

+ 4 - 3
general/g.list/testsuite/test_g_list.py

@@ -1,10 +1,11 @@
 """g.list tests"""
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 
 
-class GMlistWrongParamertersTest(grass.gunittest.TestCase):
+class GMlistWrongParamertersTest(TestCase):
     """Test wrong input of parameters for g.list module"""
 
     @classmethod
@@ -52,4 +53,4 @@ class GMlistWrongParamertersTest(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 5 - 4
general/g.remove/testsuite/test_g_remove.py

@@ -3,7 +3,8 @@
 # TODO: rmapcalc probably fatals, replace or add raise on error?
 from grass.script.raster import mapcalc as rmapcalc
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gutils import get_current_mapset
 from grass.gunittest.gmodules import SimpleModule
 
@@ -35,7 +36,7 @@ Removing raster <test_two>
 """
 
 
-class GMRemoveTest(grass.gunittest.TestCase):
+class GMRemoveTest(TestCase):
     """Test removing with g.remove"""
 
     @classmethod
@@ -92,7 +93,7 @@ class GMRemoveTest(grass.gunittest.TestCase):
                                  msg="4 maps should be removed")
 
 
-class GMRemoveWrongInputTest(grass.gunittest.TestCase):
+class GMRemoveWrongInputTest(TestCase):
     """Test wrong input of parameters for g.remove module"""
 
     def test_re_flags(self):
@@ -106,4 +107,4 @@ class GMRemoveWrongInputTest(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
general/g.rename/testsuite/test_overwrite.py

@@ -8,14 +8,15 @@ for details.
 :author: Vaclav Petras
 """
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gutils import is_map_in_mapset
 from grass.gunittest.checkers import (text_to_keyvalue, keyvalue_equals,
                                       diff_keyvalue)
 
 
-class RasterRenameTestCase(grass.gunittest.TestCase):
+class RasterRenameTestCase(TestCase):
     """Test wrong input of parameters for g.list module"""
 
     def setUp(self):
@@ -116,4 +117,4 @@ class RasterRenameTestCase(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 2
lib/python/docs/src/gunittest_testing.rst

@@ -44,7 +44,8 @@ it must be placed into a directory named ``testsuite``.
 
 .. code-block:: python
 
-    from grass.gunittest import TestCase, test
+    from grass.gunittest.case import TestCase
+    from grass.gunittest.main import test
 
 
     # test case class must be derived from grass.gunittest.TestCase
@@ -234,7 +235,8 @@ think using one or more assert methods.
 
 ::
 
-    from grass.gunittest import TestCase, test
+    from grass.gunittest.case import TestCase
+    from grass.gunittest.main import test
 
 
     class TestPython(TestCase):

+ 3 - 1
lib/python/exceptions/testsuite/test_ScriptError.py

@@ -1,5 +1,7 @@
 # -*- coding: utf-8 -*-
-from grass.gunittest import TestCase, test
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.exceptions import ScriptError
 
 

+ 2 - 20
lib/python/gunittest/__init__.py

@@ -12,23 +12,5 @@ Initial version of `gunittest` was created during Google Summer of Code 2014
 by Vaclav Petras as a student and Soeren Gebbert as a mentor.
 """
 
-# TODO: consider removing all from here before the backport or release
-
-from __future__ import print_function
-
-try:
-    from .case import TestCase
-    from .main import test
-except ImportError, e:
-    print('WARNING: Cannot import ({e.message}).\n'
-          'Ignoring the failed import because it does not harm if you need'
-          ' something different'
-          ' from gunittest. Probably the environment is not set properly'
-          ' (e.g. dynamic libraries are not available and ctypes-based modules'
-          ' cannot work).'.format(e=e))
-    # we need to ignore import errors for the cases when we just need
-    # gunittest for reports and ctypes are not available (or the environment
-    # is not set properly)
-    # .main probably does not need to be checked but it imports a lot of
-    # things, so it might be hard to keep track in the future
-    # .case imports PyGRASS which imports ctypes modules in its __init__.py
+# Using an empty init file to minimize requirements when importing
+# and show clearly the issue when it occurs (before a try-except was used).

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_errors/testsuite/test_error.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestError(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_errors/testsuite/test_import_error.py

@@ -4,7 +4,8 @@
 # (if it is imported before all tests start and everything would fail)
 #import this_module_or_package_does_not_exists__testing_import_error
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestNeverCalled(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_gfatalerror.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 
 import grass.lib.gis as libgis
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestGFatalError(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_osexit_one.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 
 import os
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestOsExit(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_osexit_zero.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 
 import os
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestOsExit(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_segfaut.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 
 import ctypes
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestSegfault(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_sysexit_one.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 
 import sys
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestSysExit(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_errors/subsubmodule_exiting/testsuite/test_sysexit_zero.py

@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 
 import sys
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestSysExit(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/submodule_test_fail/testsuite/test_fail.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestFail(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/testsuite/test_good_and_bad.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestSuccessAndFailure(TestCase):

+ 2 - 1
lib/python/gunittest/testsuite/data/samplecode/testsuite/test_success.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 class TestSuccessVerboseSetUp(TestCase):

+ 8 - 7
lib/python/gunittest/testsuite/test_assertions.py

@@ -10,11 +10,12 @@ import os
 import grass.script.core as gcore
 from grass.pygrass.modules import Module
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 
 
-class TestTextAssertions(grass.gunittest.TestCase):
+class TestTextAssertions(TestCase):
     # pylint: disable=R0904
 
     std_newline = "aaa\nbbb\n"
@@ -112,7 +113,7 @@ max=156.329864501953
 ELEVATION_MINMAX_DICT = {'min': 55.58, 'max': 156.33}
 
 
-class TestAssertModuleKeyValue(grass.gunittest.TestCase):
+class TestAssertModuleKeyValue(TestCase):
     """Test usage of `assertModuleKeyValue` method."""
     # pylint: disable=R0904
 
@@ -154,7 +155,7 @@ class TestAssertModuleKeyValue(grass.gunittest.TestCase):
                                   precision=0.01, sep='=')
 
 
-class TestRasterMapAssertions(grass.gunittest.TestCase):
+class TestRasterMapAssertions(TestCase):
     # pylint: disable=R0904
 
     @classmethod
@@ -227,7 +228,7 @@ class TestRasterMapAssertions(grass.gunittest.TestCase):
                           msg="The difference of different maps should have huge mean")
 
 
-class TestMapExistsAssertions(grass.gunittest.TestCase):
+class TestMapExistsAssertions(TestCase):
     # pylint: disable=R0904
 
     raster_cell = 'TestMapExistsAssertions_raster_cell'
@@ -289,7 +290,7 @@ class TestMapExistsAssertions(grass.gunittest.TestCase):
                           msg="Rasters from different mapsets should be ignored")
 
 
-class TestFileAssertions(grass.gunittest.TestCase):
+class TestFileAssertions(TestCase):
     # pylint: disable=R0904
 
     @classmethod
@@ -353,4 +354,4 @@ class TestFileAssertions(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 5
lib/python/gunittest/testsuite/test_assertions_rast3d.py

@@ -4,13 +4,12 @@
 Tests assertion methods for 3D rasters.
 """
 
-
 from grass.exceptions import CalledModuleError
-
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
-class TestRaster3dMapAssertions(gunittest.TestCase):
+class TestRaster3dMapAssertions(TestCase):
     # pylint: disable=R0904
     constant_map = 'raster3d_assertions_constant'
     rcd_increasing_map = 'raster3d_assertions_rcd_increasing'
@@ -125,4 +124,4 @@ class TestRaster3dMapAssertions(gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 5 - 4
lib/python/gunittest/testsuite/test_assertions_vect.py

@@ -5,7 +5,8 @@ Tests assertion methods for vectors.
 """
 
 from grass.exceptions import CalledModuleError
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 V_UNIVAR_BRIDGES_WIDTH_SUBSET = """n=10938
@@ -54,7 +55,7 @@ V_UNIVAR_BRIDGES_EXTENDED = dict(
 )
 
 
-class TestVectorInfoAssertions(gunittest.TestCase):
+class TestVectorInfoAssertions(TestCase):
     """Test assertions of map meta and statistics"""
     # pylint: disable=R0904
     def test_assertVectorFitsUnivar(self):
@@ -121,7 +122,7 @@ class TestVectorInfoAssertions(gunittest.TestCase):
                           'bridges', 'does_not_exist', precision=0.00000001)
 
 
-class TestVectorGeometryAssertions(gunittest.TestCase):
+class TestVectorGeometryAssertions(TestCase):
     """Test assertions of map geometry"""
     # pylint: disable=R0904
     maps_to_remove = []
@@ -228,4 +229,4 @@ class TestVectorGeometryAssertions(gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 9 - 8
lib/python/gunittest/testsuite/test_checkers.py

@@ -16,7 +16,8 @@ for details.
 
 from grass.script.utils import parse_key_val, try_remove
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.checkers import (
     values_equal, text_to_keyvalue,
     keyvalue_equals, proj_info_equals, proj_units_equals,
@@ -24,7 +25,7 @@ from grass.gunittest.checkers import (
 
 
 
-class TestValuesEqual(grass.gunittest.TestCase):
+class TestValuesEqual(TestCase):
 
     def test_floats(self):
         self.assertTrue(values_equal(5.0, 5.0))
@@ -117,7 +118,7 @@ meters: 1
 # what about keys and lower/upper case letters
 
 
-class TestTextToKeyValue(grass.gunittest.TestCase):
+class TestTextToKeyValue(TestCase):
     def test_conversion(self):
         keyvals = text_to_keyvalue(KEYVAL_TEXT, sep=':', val_sep=',')
         expected = {'s': 'Hello',
@@ -219,14 +220,14 @@ R_UNIVAR_KEYVAL_INT_DICT = {'n': 2025000,
                             'null_cells': 57995100, 'cells': 60020100}
 
 
-class TestComapreProjections(grass.gunittest.TestCase):
+class TestComapreProjections(TestCase):
 
     def test_compare_proj_info(self):
         self.assertTrue(proj_info_equals(PROJ_INFO_TEXT_1, PROJ_INFO_TEXT_2))
         self.assertTrue(proj_units_equals(PROJ_UNITS_TEXT_1, PROJ_UNITS_TEXT_2))
 
 
-class TestParseKeyvalue(grass.gunittest.TestCase):
+class TestParseKeyvalue(TestCase):
 
     def test_shell_script_style(self):
 
@@ -278,7 +279,7 @@ max=156.329864501953
 """
 
 
-class TestRasterMapComparisons(grass.gunittest.TestCase):
+class TestRasterMapComparisons(TestCase):
 
     def test_compare_univars(self):
         self.assertTrue(keyvalue_equals(text_to_keyvalue(R_UNIVAR_ELEVATION,
@@ -326,7 +327,7 @@ INCORRECT_LINES = [
 ]
 
 
-class TestMd5Sums(grass.gunittest.TestCase):
+class TestMd5Sums(TestCase):
     r"""
 
     To create MD5 which is used for testing use:
@@ -394,4 +395,4 @@ class TestMd5Sums(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 8 - 4
lib/python/gunittest/testsuite/test_doctests.py

@@ -5,9 +5,13 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
+import grass.gunittest.gmodules
+import grass.gunittest.checkers
+
 
 # doctest does not allow changing the base classes of test case, skip test case
 # and test suite, so we need to create a new type which inherits from our class
@@ -15,10 +19,10 @@ import grass.gunittest.utils
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -34,4 +38,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 4 - 3
lib/python/gunittest/testsuite/test_gmodules.py

@@ -2,7 +2,8 @@
 
 import subprocess
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import (call_module, CalledModuleError)
 
 G_REGION_OUTPUT = """n=...
@@ -17,7 +18,7 @@ cells=...
 """
 
 
-class TestCallModuleFunction(grass.gunittest.TestCase):
+class TestCallModuleFunction(TestCase):
 
     def test_output(self):
         output = call_module('g.region', flags='pg')
@@ -89,4 +90,4 @@ class TestCallModuleFunction(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 5 - 4
lib/python/gunittest/testsuite/test_module_assertions.py

@@ -6,11 +6,12 @@ import subprocess
 from grass.pygrass.modules import Module
 from grass.gunittest.gmodules import SimpleModule
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import CalledModuleError
 
 
-class TestModuleAssertions(grass.gunittest.TestCase):
+class TestModuleAssertions(TestCase):
     """Test assertions using PyGRASS Module"""
     # pylint: disable=R0904
 
@@ -43,7 +44,7 @@ class TestModuleAssertions(grass.gunittest.TestCase):
         self.assertRaises(self.failureException, self.assertModuleFail, self.rinfo)
 
 
-class TestSimpleModuleAssertions(grass.gunittest.TestCase):
+class TestSimpleModuleAssertions(TestCase):
     """Test assertions using SimpleModule"""
     # pylint: disable=R0904
 
@@ -77,4 +78,4 @@ class TestSimpleModuleAssertions(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 5 - 4
lib/python/pygrass/gis/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.gis as pgrass
@@ -17,10 +18,10 @@ import grass.pygrass.gis as pgrass
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -36,4 +37,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 3 - 2
lib/python/pygrass/gis/testsuite/test_gis.py

@@ -3,12 +3,13 @@
 Luca Delucchi
 """
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.pygrass.gis.region import Region
 
 
-class RegionTestCate(TestCase):
+class RegionTestCase(TestCase):
 
     def test_bounds(self):
         reg1 = Region()

+ 5 - 4
lib/python/pygrass/messages/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.messages as gmessages
@@ -17,10 +18,10 @@ import grass.pygrass.messages as gmessages
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -35,4 +36,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 5 - 4
lib/python/pygrass/modules/grid/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.modules as gmodules
@@ -17,10 +18,10 @@ import grass.pygrass.modules as gmodules
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -35,4 +36,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 5 - 4
lib/python/pygrass/modules/interface/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.modules as gmodules
@@ -17,10 +18,10 @@ import grass.pygrass.modules as gmodules
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -38,4 +39,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 2 - 1
lib/python/pygrass/modules/interface/testsuite/test_modules.py

@@ -5,7 +5,8 @@ Created on Tue Jun 24 09:43:53 2014
 @author: pietro
 """
 from fnmatch import fnmatch
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.script.core import get_commands
 from grass.pygrass.modules.interface import Module

+ 2 - 1
lib/python/pygrass/modules/interface/testsuite/test_parameter.py

@@ -5,7 +5,8 @@ Created on Fri Jul  4 16:32:54 2014
 @author: pietro
 """
 from __future__ import print_function
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.pygrass.modules.interface.parameter import Parameter, _check_value
 

+ 5 - 4
lib/python/pygrass/modules/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.modules as gmodules
@@ -17,10 +18,10 @@ import grass.pygrass.modules as gmodules
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -39,4 +40,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 2 - 1
lib/python/pygrass/raster/testsuite/test_category.py

@@ -5,7 +5,8 @@ Created on Mon Sep 15 17:09:40 2014
 @author: lucadelu
 """
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.pygrass.raster import RasterRow
 from grass.pygrass.raster.category import Category

+ 5 - 4
lib/python/pygrass/raster/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.raster as pgrass
@@ -17,10 +18,10 @@ import grass.pygrass.raster as pgrass
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -38,4 +39,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 2 - 1
lib/python/pygrass/raster/testsuite/test_history.py

@@ -5,7 +5,8 @@ Created on Mon Sep 15 17:09:40 2014
 @author: lucadelu
 """
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.pygrass.raster import RasterRow
 from grass.pygrass.raster.history import History

+ 2 - 1
lib/python/pygrass/raster/testsuite/test_raster.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from grass.exceptions import OpenError
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from unittest import skip
 
 from grass.pygrass.raster import RasterRow

+ 5 - 4
lib/python/pygrass/shell/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.shell as gshell
@@ -17,10 +18,10 @@ import grass.pygrass.shell as gshell
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -36,4 +37,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 5 - 4
lib/python/pygrass/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.utils as gutils
@@ -17,10 +18,10 @@ import grass.pygrass.utils as gutils
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -35,4 +36,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 5 - 4
lib/python/pygrass/vector/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.pygrass.vector as gvector
@@ -17,10 +18,10 @@ import grass.pygrass.vector as gvector
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -41,4 +42,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 2 - 1
lib/python/pygrass/vector/testsuite/test_geometry.py

@@ -8,7 +8,8 @@ import sys
 import unittest
 import numpy as np
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 import grass.lib.vector as libvect
 

+ 2 - 1
lib/python/pygrass/vector/testsuite/test_table.py

@@ -11,7 +11,8 @@ from string import ascii_letters, digits
 from random import choice
 import numpy as np
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.pygrass.vector.table import Table, get_path
 

+ 2 - 1
lib/python/pygrass/vector/testsuite/test_vector.py

@@ -4,7 +4,8 @@ Created on Wed Jun 18 17:21:42 2014
 
 @author: pietro
 """
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.pygrass.vector import VectorTopo
 

+ 2 - 1
lib/python/pygrass/vector/testsuite/test_vector3d.py

@@ -6,7 +6,8 @@ Created on Wed Jun 18 17:21:42 2014
 """
 import numpy as np
 
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.script.core import run_command
 

+ 5 - 4
lib/python/script/testsuite/test_doctests.py

@@ -5,7 +5,8 @@ Tests checkers
 
 import doctest
 
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
 
 import grass.script.array as garray
@@ -17,10 +18,10 @@ import grass.script.array as garray
 # the alternative is to copy 500 from doctest and change what is needed
 # (this might be necessary anyway beacuse of the reports and stdout and stderr)
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
 
@@ -35,4 +36,4 @@ def load_tests(loader, tests, ignore):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 4 - 3
lib/python/script/testsuite/test_start_command_functions.py

@@ -1,11 +1,12 @@
 """Tests of start_command function family (location independent)"""
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.script.core import start_command, PIPE
 
 
-class TestPythonKeywordsInParameters(grass.gunittest.TestCase):
+class TestPythonKeywordsInParameters(TestCase):
     """Tests additional underscore syntax which helps to avoid Python keywords
 
     It works the same for keywords, buildins and any names.
@@ -38,4 +39,4 @@ class TestPythonKeywordsInParameters(grass.gunittest.TestCase):
         self.assertIn('raster', stderr)
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
lib/python/script/testsuite/test_start_command_functions_nc.py

@@ -2,12 +2,13 @@
 
 LOCATION = 'nc'
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 from grass.script.core import start_command, PIPE
 
 
-class TestPythonKeywordsInParameters(grass.gunittest.TestCase):
+class TestPythonKeywordsInParameters(TestCase):
     """Tests additional underscore syntax which helps to avoid Python keywords
 
     It works the same for keywords, buildins and any names.
@@ -50,4 +51,4 @@ class TestPythonKeywordsInParameters(grass.gunittest.TestCase):
         self.assertIn('raster', stderr)
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 8 - 5
lib/python/temporal/testsuite/test_doctests.py

@@ -5,17 +5,19 @@ Temporal framework doctests
 
 import doctest
 import grass.temporal
-import grass.gunittest
+import grass.gunittest.case
+import grass.gunittest.main
 import grass.gunittest.utils
-import os
+
 
 doctest.DocFileCase = type('DocFileCase',
-                           (grass.gunittest.TestCase,),
+                           (grass.gunittest.case.TestCase,),
                            dict(doctest.DocFileCase.__dict__))
 doctest.SkipDocTestCase = type('SkipDocTestCase',
-                               (grass.gunittest.TestCase,),
+                               (grass.gunittest.case.TestCase,),
                                dict(doctest.SkipDocTestCase.__dict__))
 
+
 def load_tests(loader, tests, ignore):
     grass.gunittest.utils.do_doctest_gettext_workaround()
     tests.addTests(doctest.DocTestSuite(grass.temporal.abstract_dataset))
@@ -46,5 +48,6 @@ def load_tests(loader, tests, ignore):
     tests.addTests(doctest.DocTestSuite(grass.temporal.c_libraries_interface))
     return tests
 
+
 if __name__ == '__main__':
-    grass.gunittest.test()
+    grass.gunittest.main.test()

+ 4 - 3
lib/python/temporal/testsuite/test_register_function.py

@@ -10,11 +10,12 @@ for details.
 """
 
 import grass.temporal as tgis
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 import datetime
 import os
 
-class TestRegisterFunctions(grass.gunittest.TestCase):
+class TestRegisterFunctions(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -301,4 +302,4 @@ class TestRegisterFunctions(grass.gunittest.TestCase):
         self.assertEqual(unit, "seconds")
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
lib/python/temporal/testsuite/unittests_temporal_algebra.py

@@ -9,11 +9,12 @@ for details.
 
 import grass.script
 import grass.temporal as tgis
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 import datetime
 import os
 
-class TestTemporalAlgebra(grass.gunittest.TestCase):
+class TestTemporalAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -385,4 +386,4 @@ class TestTemporalAlgebra(grass.gunittest.TestCase):
         self.assertEqual(D.get_granularity(),  u'1 day')
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
lib/python/temporal/testsuite/unittests_temporal_algebra_grs.py

@@ -9,11 +9,12 @@ for details.
 
 import grass.script
 import grass.temporal as tgis
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 import datetime
 import os
 
-class TestTemporalAlgebraGranularity(grass.gunittest.TestCase):
+class TestTemporalAlgebraGranularity(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -225,4 +226,4 @@ class TestTemporalAlgebraGranularity(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
lib/python/temporal/testsuite/unittests_temporal_conditionals.py

@@ -9,11 +9,12 @@ for details.
 
 import grass.script
 import grass.temporal as tgis
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 import datetime
 import os
 
-class TestTemporalConditionals(grass.gunittest.TestCase):
+class TestTemporalConditionals(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -350,7 +351,7 @@ class TestTemporalConditionals(grass.gunittest.TestCase):
         self.assertEqual(D.get_granularity(),  u'2 days')
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()
 
 
 

+ 6 - 7
lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py

@@ -10,11 +10,12 @@ for details.
 
 import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 import datetime
-import os
 
-class TestTemporalRaster3dAlgebra(gunittest.TestCase):
+
+class TestTemporalRaster3dAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -76,8 +77,6 @@ class TestTemporalRaster3dAlgebra(gunittest.TestCase):
         self.assertEqual(start, datetime.datetime(2001, 1, 2))
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
 
-if __name__ == '__main__':
-    grass.gunittest.test()
-
-
 
+if __name__ == '__main__':
+    test()

+ 6 - 5
lib/python/temporal/testsuite/unittests_temporal_raster_algebra.py

@@ -8,12 +8,12 @@ for details.
 """
 
 import datetime
-import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTemporalRasterAlgebra(gunittest.TestCase):
+
+class TestTemporalRasterAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -707,5 +707,6 @@ class TestTemporalRasterAlgebra(gunittest.TestCase):
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 day')
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 5
lib/python/temporal/testsuite/unittests_temporal_raster_algebra_grs.py

@@ -8,12 +8,12 @@ for details.
 """
 
 import datetime
-import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTemporalRasterAlgebra(gunittest.TestCase):
+
+class TestTemporalRasterAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -273,5 +273,6 @@ class TestTemporalRasterAlgebra(gunittest.TestCase):
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 month')
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 5
lib/python/temporal/testsuite/unittests_temporal_raster_conditionals.py

@@ -8,12 +8,12 @@ for details.
 """
 
 import datetime
-import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTemporalRasterAlgebraConditionals(gunittest.TestCase):
+
+class TestTemporalRasterAlgebraConditionals(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -494,5 +494,6 @@ class TestTemporalRasterAlgebraConditionals(gunittest.TestCase):
         self.assertEqual( R.check_temporal_topology(),  True)
         self.assertEqual(R.get_granularity(),  u'1 day')
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 8
lib/python/temporal/testsuite/unittests_temporal_vector_algebra.py

@@ -8,12 +8,12 @@ for details.
 """
 
 import datetime
-import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTemporalVectorAlgebra(gunittest.TestCase):
+
+class TestTemporalVectorAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -202,8 +202,6 @@ class TestTemporalVectorAlgebra(gunittest.TestCase):
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 day')
 
-if __name__ == '__main__':
-    gunittest.test()
-
-
 
+if __name__ == '__main__':
+    test()

+ 4 - 3
raster/r.in.poly/testsuite/test_rinpoly.py

@@ -1,6 +1,7 @@
 import os
 import tempfile
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.script.core import read_command
 
 
@@ -24,7 +25,7 @@ L
 """
 
 
-class TestRInPoly(grass.gunittest.TestCase):
+class TestRInPoly(TestCase):
 
     rinpoly = 'test_rinpoly'
 
@@ -108,4 +109,4 @@ class TestRInPoly(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
raster/r.mapcalc/testsuite/test_r3_mapcalc.py

@@ -1,10 +1,11 @@
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 # TODO: add more expressions
 # TODO: add tests with prepared data
 
-class TestBasicOperations(grass.gunittest.TestCase):
+class TestBasicOperations(TestCase):
 
     # TODO: replace by unified handing of maps
     to_remove = []
@@ -53,4 +54,4 @@ class TestBasicOperations(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 5 - 4
raster/r.mapcalc/testsuite/test_r_mapcalc.py

@@ -1,4 +1,5 @@
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 
 cell_seed_500 = """\
@@ -59,7 +60,7 @@ cols: 10
 """
 
 
-class TestRandFunction(grass.gunittest.TestCase):
+class TestRandFunction(TestCase):
 
     # TODO: replace by unified handing of maps
     to_remove = []
@@ -164,7 +165,7 @@ class TestRandFunction(grass.gunittest.TestCase):
 # TODO: add more expressions
 # TODO: add tests with prepared data
 
-class TestBasicOperations(grass.gunittest.TestCase):
+class TestBasicOperations(TestCase):
 
     # TODO: replace by unified handing of maps
     to_remove = []
@@ -220,4 +221,4 @@ class TestBasicOperations(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 2 - 1
raster/r.profile/testsuite/test_profile_ncspm.py

@@ -1,4 +1,5 @@
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 import grass.script.core as gcore
 

+ 2 - 1
raster/r.recode/testsuite/test_rrecode_ncspm.py

@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.script.core import read_command
 

+ 7 - 6
raster/r.slope.aspect/testsuite/test_r_slope_aspect.py

@@ -1,4 +1,5 @@
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import call_module
 
 SMALL_MAP = """\
@@ -16,7 +17,7 @@ cols:    5
 100.0 150.0 150.0 100.0 100.0
 """
 
-class TestSlopeAspect(grass.gunittest.TestCase):
+class TestSlopeAspect(TestCase):
 
     def test_limits(self):
         slope = 'limits_slope'
@@ -39,7 +40,7 @@ class TestSlopeAspect(grass.gunittest.TestCase):
                                 msg="Aspect in degrees must be between 0 and 360")
 
 
-class TestSlopeAspectAgainstReference(grass.gunittest.TestCase):
+class TestSlopeAspectAgainstReference(TestCase):
     """
 
     Data created using::
@@ -102,7 +103,7 @@ class TestSlopeAspectAgainstReference(grass.gunittest.TestCase):
                                        precision=self.precision)
 
 
-class TestSlopeAspectAgainstItself(grass.gunittest.TestCase):
+class TestSlopeAspectAgainstItself(TestCase):
 
     precision = 0.0000001
 
@@ -136,7 +137,7 @@ class TestSlopeAspectAgainstItself(grass.gunittest.TestCase):
 
 
 # TODO: implement this class
-class TestExtremes(grass.gunittest.TestCase):
+class TestExtremes(TestCase):
 
     def setUp(self):
         self.use_temp_region()
@@ -160,4 +161,4 @@ class TestExtremes(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 5 - 4
raster/r.viewshed/testsuite/test_r_viewshed.py

@@ -1,8 +1,9 @@
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import call_module
 
 
-class TestViewshed(grass.gunittest.TestCase):
+class TestViewshed(TestCase):
 
     viewshed = 'test_viewshed_from_elevation'
 
@@ -60,7 +61,7 @@ class TestViewshed(grass.gunittest.TestCase):
             msg="Viewing angle above the ground must be between 0 and 180 deg")
 
 
-class TestViewshedAgainstReference(grass.gunittest.TestCase):
+class TestViewshedAgainstReference(TestCase):
     """
 
     Data created using NC data set::
@@ -120,4 +121,4 @@ class TestViewshedAgainstReference(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 4 - 3
raster/r.watershed/testsuite/r_watershed_test.py

@@ -10,10 +10,11 @@ Licence:   This program is free software under the GNU General Public
            for details.
 """
 
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
-class TestWatershed(grass.gunittest.TestCase):
+class TestWatershed(TestCase):
     """Test case for watershed module"""
 
     # Setup variables to be used for outputs
@@ -150,4 +151,4 @@ class TestWatershed(grass.gunittest.TestCase):
                                 msg='A basin value is less than 0 or greater than 1000000')
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 2 - 1
raster3d/r3.flow/testsuite/r3flow_test.py

@@ -5,7 +5,8 @@ Test of r3.flow
 @author Anna Petrasova
 """
 import os
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 seeds = """
 84.80609404|35.19733594|39.43321996

+ 2 - 1
raster3d/r3.gradient/testsuite/r3gradient_test.py

@@ -4,7 +4,8 @@ Test of r3.gradient
 
 @author Anna Petrasova
 """
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
 
 r3univar_test_grad_x = """

+ 6 - 4
temporal/t.rast.algebra/testsuite/test_raster_algebra.py

@@ -9,11 +9,12 @@ for details.
 
 import datetime
 import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTRastAlgebra(gunittest.TestCase):
+
+class TestTRastAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -690,5 +691,6 @@ class TestTRastAlgebra(gunittest.TestCase):
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 day')
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 7
temporal/t.rast.algebra/testsuite/test_raster_algebra_fails.py

@@ -7,13 +7,11 @@ for details.
 :authors: Soeren Gebbert
 """
 
-import datetime
-import os
-import grass.script
-import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTRastAlgebraFails(gunittest.TestCase):
+
+class TestTRastAlgebraFails(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -40,5 +38,6 @@ class TestTRastAlgebraFails(gunittest.TestCase):
         # Catch temporal algebra expressions that are prohibited in the raster algebra
         self.assertModuleFail("t.rast.algebra",  expression="R = strds(A) + strds(B)", basename="r")
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 4
temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity.py

@@ -9,11 +9,12 @@ for details.
 
 import datetime
 import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTRastAlgebraGranularity(gunittest.TestCase):
+
+class TestTRastAlgebraGranularity(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -223,5 +224,6 @@ class TestTRastAlgebraGranularity(gunittest.TestCase):
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 month')
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 5
temporal/t.rast.algebra/testsuite/test_raster_algebra_granularity_fails.py

@@ -7,13 +7,13 @@ for details.
 :authors: Soeren Gebbert and Thomas Leppelt
 """
 
-import datetime
 import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTRastAlgebraGranularityFails(gunittest.TestCase):
+
+class TestTRastAlgebraGranularityFails(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -59,5 +59,6 @@ class TestTRastAlgebraGranularityFails(gunittest.TestCase):
         # Invalid temporal topology
         self.assertModuleFail("t.rast.algebra", flags="g",  expression="R = A + A", basename="r")
 
+
 if __name__ == '__main__':
-    gunittest.test()
+    test()

+ 6 - 7
temporal/t.rast3d.algebra/testsuite/test_raster3d_algebra.py

@@ -10,11 +10,13 @@ for details.
 
 import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 import datetime
 import os
 
-class TestTRast3dAlgebra(gunittest.TestCase):
+
+class TestTRast3dAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -93,7 +95,7 @@ class TestTRast3dAlgebra(gunittest.TestCase):
         self.assertEqual(end, datetime.datetime(2001, 1, 4))
 
 
-class TestTRast3dAlgebraFails(gunittest.TestCase):
+class TestTRast3dAlgebraFails(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -121,7 +123,4 @@ class TestTRast3dAlgebraFails(gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
-
-
-
+    test()

+ 6 - 7
temporal/t.vect.algebra/testsuite/test_vector_algebra.py

@@ -9,11 +9,12 @@ for details.
 
 import datetime
 import os
-import grass.script
 import grass.temporal as tgis
-import grass.gunittest as gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 
-class TestTemporalVectorAlgebra(gunittest.TestCase):
+
+class TestTemporalVectorAlgebra(TestCase):
 
     @classmethod
     def setUpClass(cls):
@@ -187,8 +188,6 @@ class TestTemporalVectorAlgebra(gunittest.TestCase):
         self.assertEqual( D.check_temporal_topology(),  True)
         self.assertEqual(D.get_granularity(),  u'1 day')
 
-if __name__ == '__main__':
-    gunittest.test()
-
-
 
+if __name__ == '__main__':
+    test()

+ 4 - 3
vector/v.net/testsuite/test_v_net.py

@@ -1,8 +1,9 @@
-import grass.gunittest
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.script.core import read_command
 
 
-class TestVNet(grass.gunittest.TestCase):
+class TestVNet(TestCase):
 
     network = 'test_vnet'
 
@@ -46,4 +47,4 @@ class TestVNet(grass.gunittest.TestCase):
 
 
 if __name__ == '__main__':
-    grass.gunittest.test()
+    test()

+ 2 - 1
vector/v.what/testsuite/test_vwhat_layers.py

@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 
 out1 = """East: 634243

+ 2 - 1
vector/v.what/testsuite/test_vwhat_ncspm.py

@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-from grass.gunittest import TestCase, test
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule