@@ -861,9 +861,9 @@ def test_toy_hierarchical(self):
861861 # check that toolchain load is expanded to loads for toolchain dependencies,
862862 # except for the ones that extend $MODULEPATH to make the toy module available
863863 if get_module_syntax () == 'Tcl' :
864- load_regex_template = "load %s"
864+ load_regex_template = "( load|depends-on) %s"
865865 elif get_module_syntax () == 'Lua' :
866- load_regex_template = r'load\("%s/.*"\)'
866+ load_regex_template = r'( load|depends_on) \("%s/.*"\)'
867867 else :
868868 self .fail ("Unknown module syntax: %s" % get_module_syntax ())
869869
@@ -892,7 +892,7 @@ def test_toy_hierarchical(self):
892892
893893 # no dependencies or toolchain => no module load statements in module file
894894 modtxt = read_file (toy_module_path )
895- self .assertFalse (re .search ("module load" , modtxt ))
895+ self .assertFalse (re .search ("( module load|depends-on) " , modtxt ))
896896 os .remove (toy_module_path )
897897 # test module path with GCC/6.4.0-2.28 build, pretend to be an MPI lib by setting moduleclass
898898 extra_args = [
@@ -952,7 +952,7 @@ def test_toy_hierarchical(self):
952952
953953 # no dependencies or toolchain => no module load statements in module file
954954 modtxt = read_file (toy_module_path )
955- self .assertFalse (re .search ("module load" , modtxt ))
955+ self .assertFalse (re .search ("( module load|depends-on) " , modtxt ))
956956 os .remove (toy_module_path )
957957
958958 # test module path with system/system build, pretend to be a compiler by setting moduleclass
@@ -1727,8 +1727,10 @@ def test_module_only(self):
17271727
17281728 # make sure load statements for dependencies are included in additional module file generated with --module-only
17291729 modtxt = read_file (toy_mod )
1730- self .assertTrue (re .search ('load.*intel/2018a' , modtxt ), "load statement for intel/2018a found in module" )
1731- self .assertTrue (re .search ('load.*GCC/6.4.0-2.28' , modtxt ), "load statement for GCC/6.4.0-2.28 found in module" )
1730+ self .assertTrue (re .search ('(load|depends[-_]on).*intel/2018a' , modtxt ),
1731+ "load statement for intel/2018a found in module: %s" % modtxt )
1732+ self .assertTrue (re .search ('(load|depends[-_]on).*GCC/6.4.0-2.28' , modtxt ),
1733+ "load statement for GCC/6.4.0-2.28 found in module: %s" % modtxt )
17321734
17331735 os .remove (toy_mod )
17341736
@@ -1770,7 +1772,8 @@ def test_module_only(self):
17701772
17711773 # make sure load statements for dependencies are included
17721774 modtxt = read_file (toy_core_mod )
1773- self .assertTrue (re .search ('load.*intel/2018a' , modtxt ), "load statement for intel/2018a found in module" )
1775+ self .assertTrue (re .search ('(load|depends[-_]on).*intel/2018a' , modtxt ),
1776+ "load statement for intel/2018a found in module: %s" % modtxt )
17741777
17751778 # Test we can create a module even for an installation where we don't have write permissions
17761779 os .remove (toy_core_mod )
@@ -1788,7 +1791,8 @@ def test_module_only(self):
17881791
17891792 # make sure load statements for dependencies are included
17901793 modtxt = read_file (toy_core_mod )
1791- self .assertTrue (re .search ('load.*intel/2018a' , modtxt ), "load statement for intel/2018a found in module" )
1794+ self .assertTrue (re .search ('(load|depends[-_]).*intel/2018a' , modtxt ),
1795+ "load statement for intel/2018a found in module: %s" % modtxt )
17921796
17931797 os .remove (toy_core_mod )
17941798 os .remove (toy_mod )
@@ -1814,7 +1818,8 @@ def test_module_only(self):
18141818
18151819 # make sure load statements for dependencies are included
18161820 modtxt = read_file (toy_mod + '.lua' )
1817- self .assertTrue (re .search ('load.*intel/2018a' , modtxt ), "load statement for intel/2018a found in module" )
1821+ self .assertTrue (re .search ('(load|depends[-_]).*intel/2018a' , modtxt ),
1822+ "load statement for intel/2018a found in module: %s" % modtxt )
18181823
18191824 def test_module_only_extensions (self ):
18201825 """
@@ -2350,7 +2355,8 @@ def test_toy_toy(self):
23502355
23512356 mod2_txt = read_file (mod2 )
23522357
2353- load1_regex = re .compile ('load.*toy/0.0-one' , re .M )
2358+ # load statement is (by default) either depends_on (Lua) or depends-on (Tcl)
2359+ load1_regex = re .compile ('(load|depends[-_]on).*toy/0.0-one' , re .M )
23542360 self .assertTrue (load1_regex .search (mod2_txt ), "Pattern '%s' found in: %s" % (load1_regex .pattern , mod2_txt ))
23552361
23562362 # Check the contents of the dumped env in the reprod dir to ensure it contains the dependency load
@@ -3183,14 +3189,18 @@ def test_toy_multi_deps(self):
31833189 # check whether (guarded) load statement for first version listed in multi_deps is there
31843190 if get_module_syntax () == 'Lua' :
31853191 expected = '\n ' .join ([
3186- 'if not ( isloaded("GCC/4.6.3") ) and not ( isloaded("GCC/7.3.0-2.30") ) then' ,
3187- ' load("GCC/4.6.3")' ,
3192+ 'if mode() == "unload" or isloaded("GCC/7.3.0-2.30") then' ,
3193+ ' depends_on("GCC")' ,
3194+ 'else' ,
3195+ ' depends_on("GCC/4.6.3")' ,
31883196 'end' ,
31893197 ])
31903198 else :
31913199 expected = '\n ' .join ([
3192- 'if { ![ is-loaded GCC/4.6.3 ] && ![ is-loaded GCC/7.3.0-2.30 ] } {' ,
3193- ' module load GCC/4.6.3' ,
3200+ 'if { [ module-info mode remove ] || [ is-loaded GCC/7.3.0-2.30 ] } {' ,
3201+ ' depends-on GCC' ,
3202+ '} else {' ,
3203+ ' depends-on GCC/4.6.3' ,
31943204 '}' ,
31953205 ])
31963206
0 commit comments