Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt module show command run to cope with Environment Modules v5.5+ #4739

Open
wants to merge 2 commits into
base: 5.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion easybuild/tools/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,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)

Expand Down
10 changes: 6 additions & 4 deletions test/framework/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
Loading