Skip to content

Commit

Permalink
Take Tcl getenv into account on easyblock tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xdelaruelle committed Sep 1, 2024
1 parent f40f208 commit 34ef6d5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions test/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,11 @@ def test_make_module_extend_modpath(self):
txt = eb.make_module_extend_modpath()
if module_syntax == 'Tcl':
regexs = [r'^module use ".*/modules/funky/Compiler/pi/3.14/%s"$' % c for c in modclasses]
home = r'\[if { \[info exists ::env\(HOME\)\] } { concat \$::env\(HOME\) } '
home += r'else { concat "HOME_NOT_DEFINED" } \]'
if self.modtool.supports_tcl_getenv:
home = r'\[getenv HOME "HOME_NOT_DEFINED"\]'
else:
home = r'\[if { \[info exists ::env\(HOME\)\] } { concat \$::env\(HOME\) } '
home += r'else { concat "HOME_NOT_DEFINED" } \]'
fj_usermodsdir = 'file join "%s" "funky" "Compiler/pi/3.14"' % usermodsdir
regexs.extend([
# extension for user modules is guarded
Expand Down Expand Up @@ -327,9 +330,12 @@ def test_make_module_extend_modpath(self):
for envvar in list_of_envvars:
if module_syntax == 'Tcl':
regexs = [r'^module use ".*/modules/funky/Compiler/pi/3.14/%s"$' % c for c in modclasses]
module_envvar = r'\[if \{ \[info exists ::env\(%s\)\] \} ' % envvar
module_envvar += r'\{ concat \$::env\(%s\) \} ' % envvar
module_envvar += r'else { concat "%s" } \]' % (envvar + '_NOT_DEFINED')
if self.modtool.supports_tcl_getenv:
module_envvar = r'\[getenv %s "%s"]' % (envvar, envvar + '_NOT_DEFINED')
else:
module_envvar = r'\[if \{ \[info exists ::env\(%s\)\] \} ' % envvar
module_envvar += r'\{ concat \$::env\(%s\) \} ' % envvar
module_envvar += r'else { concat "%s" } \]' % (envvar + '_NOT_DEFINED')
fj_usermodsdir = 'file join "%s" "funky" "Compiler/pi/3.14"' % usermodsdir
regexs.extend([
# extension for user modules is guarded
Expand Down

0 comments on commit 34ef6d5

Please sign in to comment.