Skip to content

Commit 0227b31

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1655 from teojgo/bugfix/unittest_module_cleanup
[ci] Ensure that module paths are restored correctly in unit tests
2 parents 4b35b02 + 2e8a8f4 commit 0227b31

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
importlib_metadata==2.0.0
22
jsonschema==3.2.0
3-
pytest==6.1.1
3+
pytest==6.2.0
44
pytest-forked==1.3.0
55
pytest-parallel==0.1.0
66
coverage==5.3

unittests/test_cli.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,7 @@ def test_unuse_module_path(run_reframe, user_exec_ctx):
671671
config_file=fixtures.USER_CONFIG_FILE, action='run',
672672
system=rt.runtime().system.name
673673
)
674+
ms.searchpath_remove(module_path)
674675
assert "could not load module 'testmod_foo' correctly" in stdout
675676
assert 'Traceback' not in stderr
676677
assert returncode == 0
@@ -687,7 +688,6 @@ def test_use_module_path(run_reframe, user_exec_ctx):
687688
config_file=fixtures.USER_CONFIG_FILE, action='run',
688689
system=rt.runtime().system.name
689690
)
690-
691691
assert 'Traceback' not in stdout
692692
assert 'Traceback' not in stderr
693693
assert "could not load module 'testmod_foo' correctly" not in stdout
@@ -708,7 +708,6 @@ def test_overwrite_module_path(run_reframe, user_exec_ctx):
708708
config_file=fixtures.USER_CONFIG_FILE, action='run',
709709
system=rt.runtime().system.name
710710
)
711-
712711
assert 'Traceback' not in stdout
713712
assert 'Traceback' not in stderr
714713
assert "could not load module 'testmod_foo' correctly" not in stdout

unittests/test_utility.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,8 @@ def modules_system(user_exec_ctx, monkeypatch):
14141414

14151415
ms = rt.runtime().system.modules_system
14161416
ms.searchpath_add(fixtures.TEST_MODULES)
1417-
return ms
1417+
yield ms
1418+
ms.searchpath_remove(fixtures.TEST_MODULES)
14181419

14191420

14201421
def test_find_modules(modules_system):

0 commit comments

Comments
 (0)