Skip to content

Commit 3262fc6

Browse files
committed
Add test for adding to non-existing MODULEPATH and removing it
1 parent b5e154c commit 3262fc6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/framework/modules.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,16 @@ def test_module_use_unuse(self):
12241224
self.assertEqual(os.getenv('TEST123'), 'three')
12251225
self.modtool.unload(['test'])
12261226

1227+
# Also test that load and unload a single path works when it is the only one
1228+
# Only for LMod as we have some shortcuts for avoiding the module call there
1229+
old_module_path = os.environ['MODULEPATH']
1230+
del os.environ['MODULEPATH']
1231+
self.modtool.use(test_dir1)
1232+
self.assertEqual(os.environ['MODULEPATH'], test_dir1)
1233+
self.modtool.unuse(test_dir1)
1234+
self.assertFalse('MODULEPATH' in os.environ)
1235+
os.environ['MODULEPATH'] = old_module_path # Restore
1236+
12271237
def test_module_use_bash(self):
12281238
"""Test whether effect of 'module use' is preserved when a new bash session is started."""
12291239
# this test is here as check for a nasty bug in how the modules tool is deployed

0 commit comments

Comments
 (0)