Skip to content

Commit 8ee9b92

Browse files
author
Alan O'Cais
committed
Tweak test that actually checks EB_SCRIPT_PATH
1 parent 3fef34c commit 8ee9b92

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/framework/easyconfig.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,6 +3374,11 @@ def test_get_paths_for(self):
33743374
self.mock_stderr(False)
33753375
self.assertTrue(os.path.samefile(test_ecs, res[0]))
33763376

3377+
# Can't have EB_SCRIPT_PATH set (for some of) these tests
3378+
env_eb_script_path = os.getenv('EB_SCRIPT_PATH')
3379+
if env_eb_script_path:
3380+
del os.environ['EB_SCRIPT_PATH']
3381+
33773382
# easyconfigs location can also be derived from location of 'eb'
33783383
write_file(os.path.join(self.test_prefix, 'bin', 'eb'), "#!/bin/bash; echo 'This is a fake eb'")
33793384
adjust_permissions(os.path.join(self.test_prefix, 'bin', 'eb'), stat.S_IXUSR)
@@ -3390,6 +3395,10 @@ def test_get_paths_for(self):
33903395
res = get_paths_for(subdir='easyconfigs', robot_path=None)
33913396
self.assertTrue(os.path.samefile(test_ecs, res[-1]))
33923397

3398+
# Restore EB_SCRIPT_PATH value if set originally
3399+
if env_eb_script_path:
3400+
os.environ['EB_SCRIPT_PATH'] = env_eb_script_path
3401+
33933402
# also locations in sys.path are considered
33943403
os.environ['PATH'] = orig_path
33953404
sys.path.insert(0, self.test_prefix)
@@ -3440,6 +3449,10 @@ def test_get_paths_for(self):
34403449
self.assertTrue(os.path.exists(res[0]))
34413450
self.assertTrue(os.path.samefile(res[0], os.path.join(someprefix, 'easybuild', 'easyconfigs')))
34423451

3452+
# Finally restore EB_SCRIPT_PATH value if set
3453+
if env_eb_script_path:
3454+
os.environ['EB_SCRIPT_PATH'] = env_eb_script_path
3455+
34433456
def test_is_generic_easyblock(self):
34443457
"""Test for is_generic_easyblock function."""
34453458

0 commit comments

Comments
 (0)