Skip to content

Commit

Permalink
Merge pull request #5 from boegel/module_show_modulepath
Browse files Browse the repository at this point in the history
fix broken test, modulecmd.tcl requires that paths used for 'module use' actually exist
  • Loading branch information
bartoldeman authored Mar 17, 2017
2 parents bbbcb4d + 895403a commit 23bda15
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/framework/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ def test_modpath_extensions_for(self):
os.environ['HOME'] = os.path.join(self.test_prefix, 'HOME')
os.environ['USER'] = 'testuser'

mkdir(os.path.join(self.test_prefix, os.environ['USER'], 'test'), parents=True)

# test result in case conditional loads are used
test_mod = 'test-modpaths/1.2.3.4'
test_modfile = os.path.join(mod_dir, test_mod)
Expand All @@ -460,7 +462,7 @@ def test_modpath_extensions_for(self):
"setenv EXAMPLE example",
# more (fictional) extensions that use os.getenv
'prepend-path MODULEPATH "$env(HOME)"',
'module use "/example/$env(USER)/test"',
'module use "%s/$env(USER)/test"' % self.test_prefix,
])
write_file(test_modfile, test_modtxt)

Expand All @@ -471,7 +473,7 @@ def test_modpath_extensions_for(self):
os.path.join(mod_dir, 'MPI', 'GCC', '4.7.2', 'OpenMPI', '1.6.4'),
os.path.join(os.environ['HOME'], 'modules', 'Compiler', 'GCC', '4.7.2'),
os.environ['HOME'],
os.path.join('/example', os.environ['USER'], 'test'),
os.path.join(self.test_prefix, os.environ['USER'], 'test'),
]
}
self.assertEqual(self.modtool.modpath_extensions_for([test_mod]), expected)
Expand All @@ -496,7 +498,7 @@ def test_modpath_extensions_for(self):
'setenv("EXAMPLE", "example")',
# more (fictional) extensions that use os.getenv
'prepend_path("MODULEPATH", os.getenv("HOME"))',
'prepend_path("MODULEPATH", pathJoin("/example", os.getenv("USER"), "test"))',
'prepend_path("MODULEPATH", pathJoin("%s", os.getenv("USER"), "test"))' % self.test_prefix,
])
write_file(test_modfile, test_modtxt)

Expand Down

0 comments on commit 23bda15

Please sign in to comment.