Skip to content

Commit 482860a

Browse files
committed
avoid using sys.modules.clear() in tests
1 parent 323ffb0 commit 482860a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

test/framework/options.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,6 @@ def test_xxx_include_easyblocks_from_pr(self):
30473047
return
30483048

30493049
orig_local_sys_path = sys.path[:]
3050-
orig_sys_modules = sys.modules.copy()
30513050

30523051
fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
30533052
os.close(fd)
@@ -3093,8 +3092,8 @@ def test_xxx_include_easyblocks_from_pr(self):
30933092
self.assertTrue(issubclass(klass, EasyBlock), "%s is an EasyBlock derivative class" % klass)
30943093

30953094
# 'undo' import of easyblocks
3096-
sys.modules.clear()
3097-
sys.modules.update(orig_sys_modules)
3095+
del sys.modules['easybuild.easyblocks.foo']
3096+
del sys.modules['easybuild.easyblocks.generic.cmakemake']
30983097
os.remove(os.path.join(self.test_prefix, 'foo.py'))
30993098
sys.path = orig_local_sys_path
31003099

0 commit comments

Comments
 (0)