diff --git a/easybuild/tools/modules.py b/easybuild/tools/modules.py index 8ebbb88eb3..7d52cfef92 100644 --- a/easybuild/tools/modules.py +++ b/easybuild/tools/modules.py @@ -898,7 +898,8 @@ def show(self, mod_name): ans = MODULE_SHOW_CACHE[key] self.log.debug("Found cached result for 'module show %s' with key '%s': %s", mod_name, key, ans) else: - ans = self.run_module('show', mod_name, check_output=False, return_stderr=True) + ans = self.run_module('show', mod_name, check_output=False, return_stderr=True, + check_exit_code=False) MODULE_SHOW_CACHE[key] = ans self.log.debug("Cached result for 'module show %s' with key '%s': %s", mod_name, key, ans) diff --git a/test/framework/modules.py b/test/framework/modules.py index e1f910db62..815d8697b2 100644 --- a/test/framework/modules.py +++ b/test/framework/modules.py @@ -122,10 +122,12 @@ def test_run_module(self): error_pattern = "Module command '.*thisdoesnotmakesense' failed with exit code [1-9]" self.assertErrorRegex(EasyBuildError, error_pattern, self.modtool.run_module, 'thisdoesnotmakesense') - # we need to use a different error pattern here with Environment Modules, - # because a load of a non-existing module doesnt' trigger a non-zero exit code... - # it will still fail though, just differently - if isinstance(self.modtool, EnvironmentModulesC) or isinstance(self.modtool, EnvironmentModules): + # we need to use a different error pattern here with EnvironmentModulesC and + # EnvironmentModules <5.5, because a load of a non-existing module doesnt' trigger a + # non-zero exit code. it will still fail though, just differently + version = LooseVersion(self.modtool.version) + if (isinstance(self.modtool, EnvironmentModulesC) + or (isinstance(self.modtool, EnvironmentModules) and version < '5.5')): error_pattern = "Unable to locate a modulefile for 'nosuchmodule/1.2.3'" else: error_pattern = "Module command '.*load nosuchmodule/1.2.3' failed with exit code [1-9]"