Browse Source

gunittest: explicitely check if there is an executable for the module

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67156 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 9 years ago
parent
commit
5fb9f21e74
1 changed files with 4 additions and 0 deletions
  1. 4 0
      lib/python/gunittest/case.py

+ 4 - 0
lib/python/gunittest/case.py

@@ -19,6 +19,7 @@ import unittest
 
 
 from grass.pygrass.modules import Module
 from grass.pygrass.modules import Module
 from grass.exceptions import CalledModuleError
 from grass.exceptions import CalledModuleError
+from grass.script import shutil_which
 
 
 from .gmodules import call_module, SimpleModule
 from .gmodules import call_module, SimpleModule
 from .checkers import (check_text_ellipsis,
 from .checkers import (check_text_ellipsis,
@@ -1138,6 +1139,9 @@ class TestCase(unittest.TestCase):
         """
         """
         module = _module_from_parameters(module, **kwargs)
         module = _module_from_parameters(module, **kwargs)
         _check_module_run_parameters(module)
         _check_module_run_parameters(module)
+        if not shutil_which(module.name):
+            stdmsg = "Cannot find the module '{}'".format(module.name)
+            self.fail(self._formatMessage(msg, stdmsg))
         try:
         try:
             module.run()
             module.run()
             self.grass_modules.append(module.name)
             self.grass_modules.append(module.name)