Skip to content

Commit b4de531

Browse files
committed
Make module purge unit test more robust
1 parent 1492ee9 commit b4de531

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/pavilion/errors.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,6 @@ class TestGroupError(PavilionError):
322322

323323
class LockfileError(PavilionError):
324324
"""Errors relating to lockfiles."""
325+
326+
class SchedConfigError(PavilionError):
327+
"""Raised when there's a problem with the scheduler configuration."""

lib/pavilion/unittest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def _load_test(self, name: str, platform: str = 'this', host: str = 'this',
313313
del __config_lines
314314

315315
def _quick_test(self, cfg=None, name="quick_test",
316-
build=True, finalize=True, purge=False):
316+
build=True, finalize=True, purge=True):
317317
"""Create a test run object to work with.
318318
The default is a simple hello world test with the raw scheduler.
319319

test/tests/mod_wrapper_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,14 @@ def test_module_purge(self):
318318
test_cfg['run']['cmds'] = [
319319
'[[ $(module -t list 2>&1) = "No modules loaded" ]] || exit 1',
320320
]
321+
test_cfg['run']['preamble'].append('module load test_mod1 || exit 2')
321322

322-
test = self._quick_test(test_cfg, purge=True)
323+
test = self._quick_test(test_cfg, purge=False)
324+
run_result = test.run()
325+
326+
self.assertEqual(run_result, 1)
327+
328+
test = self._quick_test(test_cfg)
323329
run_result = test.run()
324330

325331
self.assertEqual(run_result, 0)

0 commit comments

Comments
 (0)