From f3c17bc0e4148af8a69b00d2604c19082d6c96ac Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Mon, 14 Dec 2020 13:20:25 +0100 Subject: [PATCH 1/3] Ensure that module paths are restored in tests --- requirements.txt | 2 +- unittests/test_cli.py | 5 +++-- unittests/test_utility.py | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index e85dd3416f..cc28e16ad4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ importlib_metadata==2.0.0 jsonschema==3.2.0 -pytest==6.1.1 +pytest==6.2.0 pytest-forked==1.3.0 pytest-parallel==0.1.0 coverage==5.3 diff --git a/unittests/test_cli.py b/unittests/test_cli.py index 25f85ec0b5..6702401069 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -657,6 +657,7 @@ def test_unuse_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) + ms.searchpath_remove(module_path) assert "could not load module 'testmod_foo' correctly" in stdout assert 'Traceback' not in stderr assert returncode == 0 @@ -673,7 +674,7 @@ def test_use_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) - + ms.searchpath_remove(module_path) assert 'Traceback' not in stdout assert 'Traceback' not in stderr assert "could not load module 'testmod_foo' correctly" not in stdout @@ -694,7 +695,7 @@ def test_overwrite_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) - + ms.searchpath_remove(module_path) assert 'Traceback' not in stdout assert 'Traceback' not in stderr assert "could not load module 'testmod_foo' correctly" not in stdout diff --git a/unittests/test_utility.py b/unittests/test_utility.py index 2d2424a972..c1e8ae9f1d 100644 --- a/unittests/test_utility.py +++ b/unittests/test_utility.py @@ -1414,7 +1414,8 @@ def modules_system(user_exec_ctx, monkeypatch): ms = rt.runtime().system.modules_system ms.searchpath_add(fixtures.TEST_MODULES) - return ms + yield ms + ms.searchpath_remove(fixtures.TEST_MODULES) def test_find_modules(modules_system): From 818b114ad4386671c7606d881a83d92495b5d29d Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 15 Dec 2020 10:44:32 +0100 Subject: [PATCH 2/3] Address PR comments --- unittests/test_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittests/test_cli.py b/unittests/test_cli.py index 6702401069..e353ce8a22 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -674,7 +674,7 @@ def test_use_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) - ms.searchpath_remove(module_path) + #ms.searchpath_remove(module_path) assert 'Traceback' not in stdout assert 'Traceback' not in stderr assert "could not load module 'testmod_foo' correctly" not in stdout @@ -695,7 +695,7 @@ def test_overwrite_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) - ms.searchpath_remove(module_path) + #ms.searchpath_remove(module_path) assert 'Traceback' not in stdout assert 'Traceback' not in stderr assert "could not load module 'testmod_foo' correctly" not in stdout From 75dde7fce326ade00deca4b5cced96c465d412d5 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 15 Dec 2020 10:45:22 +0100 Subject: [PATCH 3/3] Remove stale comment lines --- unittests/test_cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/unittests/test_cli.py b/unittests/test_cli.py index e353ce8a22..565c8e4c26 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -674,7 +674,6 @@ def test_use_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) - #ms.searchpath_remove(module_path) assert 'Traceback' not in stdout assert 'Traceback' not in stderr assert "could not load module 'testmod_foo' correctly" not in stdout @@ -695,7 +694,6 @@ def test_overwrite_module_path(run_reframe, user_exec_ctx): config_file=fixtures.USER_CONFIG_FILE, action='run', system=rt.runtime().system.name ) - #ms.searchpath_remove(module_path) assert 'Traceback' not in stdout assert 'Traceback' not in stderr assert "could not load module 'testmod_foo' correctly" not in stdout