Skip to content

Commit 735c24c

Browse files
committed
Add test for prepend-error case
1 parent 7306de9 commit 735c24c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/framework/modules.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,19 @@ def test_prepend_module_path(self):
630630
self.assertEqual(test_path_1, modulepath[1])
631631
self.assertEqual(test_path_0, modulepath[2])
632632

633+
# When prepend fails due to a higher priority path, a warning is shown
634+
self.modtool.unuse(test_path_2)
635+
self.modtool.prepend_module_path(test_path_0, priority=999999)
636+
self.mock_stderr(True)
637+
self.modtool.prepend_module_path(test_path_2)
638+
stderr = self.get_stderr()
639+
self.mock_stderr(False)
640+
self.assertTrue('could not be prepended' in stderr)
641+
modulepath = curr_module_paths()
642+
self.assertEqual(test_path_0, modulepath[0])
643+
self.assertEqual(test_path_2, modulepath[1])
644+
self.assertEqual(test_path_1, modulepath[2])
645+
633646
def test_ld_library_path(self):
634647
"""Make sure LD_LIBRARY_PATH is what it should be when loaded multiple modules."""
635648
self.init_testmods()

0 commit comments

Comments
 (0)