lmod: fix use of custom separator in prepend_path etc. (#8737)

fixes #8736
This commit is contained in:
Stephen Herbein
2018-08-01 03:58:54 -07:00
committed by Massimiliano Culpo
parent db79c86ed6
commit de60e9d582
4 changed files with 66 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
enable:
- lmod
lmod:
core_compilers:
- 'clang@3.3'

View File

@@ -23,6 +23,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import re
import pytest
import spack.modules.lmod
@@ -151,6 +152,19 @@ def test_alter_environment(self, modulefile_content, module_configuration):
assert len([x for x in content if 'setenv("FOO", "foo")' in x]) == 0
assert len([x for x in content if 'unsetenv("BAR")' in x]) == 0
def test_prepend_path_separator(self, modulefile_content,
module_configuration):
"""Tests modifications to run-time environment."""
module_configuration('module_path_separator')
content = modulefile_content('module-path-separator')
for line in content:
if re.match(r'[a-z]+_path\("COLON"', line):
assert line.endswith('"foo", ":")')
elif re.match(r'[a-z]+_path\("SEMICOLON"', line):
assert line.endswith('"bar", ";")')
def test_blacklist(self, modulefile_content, module_configuration):
"""Tests blacklisting the generation of selected modules."""