From 7e9c7d15c3ebf4f56a2a1d7f5bf02f43031ef60e Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Mon, 23 Sep 2024 16:45:08 +0200 Subject: [PATCH] update test_make_module_req to be compatible with refactor of make_module_req --- test/framework/easyblock.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/framework/easyblock.py b/test/framework/easyblock.py index 505a1c1d2f..a667f53f0f 100644 --- a/test/framework/easyblock.py +++ b/test/framework/easyblock.py @@ -433,12 +433,13 @@ def test_make_module_req(self): # create fake directories and files that should be guessed os.makedirs(eb.installdir) - write_file(os.path.join(eb.installdir, 'foo.jar'), 'foo.jar') - write_file(os.path.join(eb.installdir, 'bla.jar'), 'bla.jar') for path in ('bin', ('bin', 'testdir'), 'sbin', 'share', ('share', 'man'), 'lib', 'lib64'): if isinstance(path, str): path = (path, ) os.mkdir(os.path.join(eb.installdir, *path)) + write_file(os.path.join(eb.installdir, 'foo.jar'), 'foo.jar') + write_file(os.path.join(eb.installdir, 'bla.jar'), 'bla.jar') + write_file(os.path.join(eb.installdir, 'share', 'man', 'pi'), 'Man page') # this is not a path that should be picked up os.mkdir(os.path.join(eb.installdir, 'CPATH')) @@ -519,7 +520,7 @@ def test_make_module_req(self): guess, re.M)), 1) # check for behavior when a string value is used as dict value by make_module_req_guesses - eb.make_module_req_guess = lambda: {'PATH': 'bin'} + eb.make_module_req_guess = lambda: {'PATH': (['bin'], False)} with eb.module_generator.start_module_creation(): txt = eb.make_module_req() if get_module_syntax() == 'Tcl': @@ -531,7 +532,7 @@ def test_make_module_req(self): # check for correct behaviour if empty string is specified as one of the values # prepend-path statements should be included for both the 'bin' subdir and the install root - eb.make_module_req_guess = lambda: {'PATH': ['bin', '']} + eb.make_module_req_guess = lambda: {'PATH': (['bin', ''], False)} with eb.module_generator.start_module_creation(): txt = eb.make_module_req() if get_module_syntax() == 'Tcl': @@ -544,7 +545,9 @@ def test_make_module_req(self): self.fail("Unknown module syntax: %s" % get_module_syntax()) # check for correct order of prepend statements when providing a list (and that no duplicates are allowed) - eb.make_module_req_guess = lambda: {'LD_LIBRARY_PATH': ['lib/pathC', 'lib/pathA', 'lib/pathB', 'lib/pathA']} + eb.make_module_req_guess = lambda: { + 'LD_LIBRARY_PATH': (['lib/pathC', 'lib/pathA', 'lib/pathB', 'lib/pathA'], False), + } for path in ['pathA', 'pathB', 'pathC']: os.mkdir(os.path.join(eb.installdir, 'lib', path)) write_file(os.path.join(eb.installdir, 'lib', path, 'libfoo.so'), 'test') @@ -572,7 +575,7 @@ def test_make_module_req(self): # If PATH or LD_LIBRARY_PATH contain only folders, do not add an entry sub_lib_path = os.path.join('lib', 'path_folders') sub_path_path = os.path.join('bin', 'path_folders') - eb.make_module_req_guess = lambda: {'LD_LIBRARY_PATH': sub_lib_path, 'PATH': sub_path_path} + eb.make_module_req_guess = lambda: {'LD_LIBRARY_PATH': (sub_lib_path, False), 'PATH': (sub_path_path, False)} for path in (sub_lib_path, sub_path_path): full_path = os.path.join(eb.installdir, path, 'subpath') os.makedirs(full_path)