@@ -531,14 +531,15 @@ def test_check_module_path(self):
531531 os .environ ['MODULEPATH' ] = test2
532532 modtool .check_module_path ()
533533 self .assertEqual (modtool .mod_paths , [mod_install_dir , test1 , test2 ])
534- self .assertEqual (os .environ ['MODULEPATH' ], mod_install_dir + ':' + test1 + ':' + test2 )
534+ self .assertEqual (os .environ ['MODULEPATH' ], os . pathsep . join ([ mod_install_dir , test1 , test2 ]) )
535535
536536 # check behaviour if non-existing directories are included in $MODULEPATH
537537 os .environ ['MODULEPATH' ] = '%s:/does/not/exist:%s' % (test3 , test2 )
538538 modtool .check_module_path ()
539539 # non-existing dir is filtered from mod_paths, but stays in $MODULEPATH
540540 self .assertEqual (modtool .mod_paths , [mod_install_dir , test1 , test3 , test2 ])
541- self .assertEqual (os .environ ['MODULEPATH' ], ':' .join ([mod_install_dir , test1 , test3 , '/does/not/exist' , test2 ]))
541+ self .assertEqual (os .environ ['MODULEPATH' ],
542+ os .pathsep .join ([mod_install_dir , test1 , test3 , '/does/not/exist' , test2 ]))
542543
543544 def test_check_module_path_hmns (self ):
544545 """Test behaviour of check_module_path with HierarchicalMNS."""
@@ -1238,16 +1239,17 @@ def test_add_and_remove_module_path(self):
12381239 self .modtool .add_module_path (test_dir1 )
12391240 self .assertEqual (os .environ ['MODULEPATH' ], test_dir1 )
12401241 self .modtool .add_module_path (test_dir2 )
1241- self .assertEqual (os .environ ['MODULEPATH' ], test_dir2 + ':' + test_dir1 )
1242+ test_dir_2_and_1 = os .pathsep .join ([test_dir2 , test_dir1 ])
1243+ self .assertEqual (os .environ ['MODULEPATH' ], test_dir_2_and_1 )
12421244 # Adding the same path does not change the path
12431245 self .modtool .add_module_path (test_dir1 )
1244- self .assertEqual (os .environ ['MODULEPATH' ], test_dir2 + ':' + test_dir1 )
1246+ self .assertEqual (os .environ ['MODULEPATH' ], test_dir_2_and_1 )
12451247 self .modtool .add_module_path (test_dir2 )
1246- self .assertEqual (os .environ ['MODULEPATH' ], test_dir2 + ':' + test_dir1 )
1248+ self .assertEqual (os .environ ['MODULEPATH' ], test_dir_2_and_1 )
12471249 # Even when a (meaningless) slash is added
12481250 # This occurs when using an empty modules directory name
12491251 self .modtool .add_module_path (os .path .join (test_dir1 , '' ))
1250- self .assertEqual (os .environ ['MODULEPATH' ], test_dir2 + ':' + test_dir1 )
1252+ self .assertEqual (os .environ ['MODULEPATH' ], test_dir_2_and_1 )
12511253
12521254 # Similar tests for remove_module_path
12531255 self .modtool .remove_module_path (test_dir2 )
@@ -1264,7 +1266,7 @@ def test_add_and_remove_module_path(self):
12641266 # Environment-Modules 4.x seems to resolve relative paths: /foo/../foo -> /foo
12651267 # Hence we can only check the real paths
12661268 def get_resolved_module_path ():
1267- return ':' . join (os .path .realpath (p ) for p in os .environ ['MODULEPATH' ].split (':' ))
1269+ return os . pathsep . join (os .path .realpath (p ) for p in os .environ ['MODULEPATH' ].split (os . pathsep ))
12681270
12691271 test_dir1_relative = os .path .join (test_dir1 , '..' , os .path .basename (test_dir1 ))
12701272 test_dir2_dot = os .path .join (os .path .dirname (test_dir2 ), '.' , os .path .basename (test_dir2 ))
@@ -1273,18 +1275,18 @@ def get_resolved_module_path():
12731275 # Adding the same path, but in a different form may be possible, but may also be ignored, e.g. in EnvModules
12741276 self .modtool .add_module_path (test_dir1 )
12751277 if get_resolved_module_path () != test_dir1 :
1276- self .assertEqual (get_resolved_module_path (), test_dir1 + ':' + test_dir1 )
1278+ self .assertEqual (get_resolved_module_path (), os . pathsep . join ([ test_dir1 , test_dir1 ]) )
12771279 self .modtool .remove_module_path (test_dir1 )
12781280 self .assertEqual (get_resolved_module_path (), test_dir1 )
12791281 self .modtool .add_module_path (test_dir2_dot )
1280- self .assertEqual (get_resolved_module_path (), test_dir2 + ':' + test_dir1 )
1282+ self .assertEqual (get_resolved_module_path (), test_dir_2_and_1 )
12811283 self .modtool .remove_module_path (test_dir2_dot )
12821284 self .assertEqual (get_resolved_module_path (), test_dir1 )
12831285 # Force adding such a dot path which can be removed with either variant
1284- os .environ ['MODULEPATH' ] = test_dir2_dot + ':' + test_dir1_relative
1286+ os .environ ['MODULEPATH' ] = os . pathsep . join ([ test_dir2_dot , test_dir1_relative ])
12851287 self .modtool .remove_module_path (test_dir2_dot )
12861288 self .assertEqual (get_resolved_module_path (), test_dir1 )
1287- os .environ ['MODULEPATH' ] = test_dir2_dot + ':' + test_dir1_relative
1289+ os .environ ['MODULEPATH' ] = os . pathsep . join ([ test_dir2_dot , test_dir1_relative ])
12881290 self .modtool .remove_module_path (test_dir2 )
12891291 self .assertEqual (get_resolved_module_path (), test_dir1 )
12901292
0 commit comments