diff options
author | Xavier Delaruelle <xavier.delaruelle@cea.fr> | 2023-10-26 15:55:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-26 15:55:49 +0200 |
commit | 751b64cbcdb86ce94a05503e853f788b94aaeb11 (patch) | |
tree | 266237d5fcea216a8fd6c4f9bfe7d653b24a268a /lib | |
parent | f57c2501a38134f1b1ec70384b3efc6fd1124468 (diff) | |
download | spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.tar.gz spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.tar.bz2 spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.tar.xz spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.zip |
modules: no --delim option if separator is colon character (#39010)
Update Tcl modulefile template to simplify generated `append-path`,
`prepend-path` and `remove-path` commands and improve their readability.
If path element delimiter is colon character, do not set the `--delim`
option as it is the default delimiter value.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/test/modules/tcl.py | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/lib/spack/spack/test/modules/tcl.py b/lib/spack/spack/test/modules/tcl.py index cc12a1eedc..4a8d9e10a2 100644 --- a/lib/spack/spack/test/modules/tcl.py +++ b/lib/spack/spack/test/modules/tcl.py @@ -133,9 +133,9 @@ class TestTcl: module_configuration("module_path_separator") content = modulefile_content("module-path-separator") - assert len([x for x in content if "append-path --delim {:} COLON {foo}" in x]) == 1 - assert len([x for x in content if "prepend-path --delim {:} COLON {foo}" in x]) == 1 - assert len([x for x in content if "remove-path --delim {:} COLON {foo}" in x]) == 1 + assert len([x for x in content if "append-path COLON {foo}" in x]) == 1 + assert len([x for x in content if "prepend-path COLON {foo}" in x]) == 1 + assert len([x for x in content if "remove-path COLON {foo}" in x]) == 1 assert len([x for x in content if "append-path --delim {;} SEMICOLON {bar}" in x]) == 1 assert len([x for x in content if "prepend-path --delim {;} SEMICOLON {bar}" in x]) == 1 assert len([x for x in content if "remove-path --delim {;} SEMICOLON {bar}" in x]) == 1 @@ -150,37 +150,23 @@ class TestTcl: # no manpath set by module content = modulefile_content("mpileaks") - assert len([x for x in content if "append-path --delim {:} MANPATH {}" in x]) == 0 + assert len([x for x in content if "append-path MANPATH {}" in x]) == 0 # manpath set by module with prepend-path content = modulefile_content("module-manpath-prepend") - assert ( - len([x for x in content if "prepend-path --delim {:} MANPATH {/path/to/man}" in x]) - == 1 - ) - assert ( - len( - [ - x - for x in content - if "prepend-path --delim {:} MANPATH {/path/to/share/man}" in x - ] - ) - == 1 - ) - assert len([x for x in content if "append-path --delim {:} MANPATH {}" in x]) == 1 + assert len([x for x in content if "prepend-path MANPATH {/path/to/man}" in x]) == 1 + assert len([x for x in content if "prepend-path MANPATH {/path/to/share/man}" in x]) == 1 + assert len([x for x in content if "append-path MANPATH {}" in x]) == 1 # manpath set by module with append-path content = modulefile_content("module-manpath-append") - assert ( - len([x for x in content if "append-path --delim {:} MANPATH {/path/to/man}" in x]) == 1 - ) - assert len([x for x in content if "append-path --delim {:} MANPATH {}" in x]) == 1 + assert len([x for x in content if "append-path MANPATH {/path/to/man}" in x]) == 1 + assert len([x for x in content if "append-path MANPATH {}" in x]) == 1 # manpath set by module with setenv content = modulefile_content("module-manpath-setenv") assert len([x for x in content if "setenv MANPATH {/path/to/man}" in x]) == 1 - assert len([x for x in content if "append-path --delim {:} MANPATH {}" in x]) == 0 + assert len([x for x in content if "append-path MANPATH {}" in x]) == 0 @pytest.mark.regression("29578") def test_setenv_raw_value(self, modulefile_content, module_configuration): |