From b02144c4f4acdfccc42e8cb6615f274127ba4807 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Fri, 23 Sep 2022 15:51:21 +0200 Subject: [PATCH 1/3] Stop execution with an error when `-m` fails --- reframe/frontend/cli.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 6f05080d4d..3c586ed806 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -1240,11 +1240,11 @@ def module_unuse(*paths): try: rt.modules_system.load_module(**m, force=True) except errors.EnvironError as e: - printer.warning( - f'could not load module {m["name"]!r} correctly; ' - f'skipping...' + printer.error( + f'could not load module {m["name"]!r} correctly' ) - printer.debug(str(e)) + printer.error(str(e)) + sys.exit(1) options.flex_alloc_nodes = options.flex_alloc_nodes or 'idle' From e6dececcea85d4f7be8f4764a0316ddbef54b884 Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Fri, 23 Sep 2022 16:06:05 +0200 Subject: [PATCH 2/3] Fix unittest --- unittests/test_cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittests/test_cli.py b/unittests/test_cli.py index 12ce3ad0e0..4527e655bb 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -721,7 +721,7 @@ def test_unuse_module_path(run_reframe, user_exec_ctx): ms.searchpath_remove(module_path) assert "could not load module 'testmod_foo' correctly" in stdout assert 'Traceback' not in stderr - assert returncode == 0 + assert returncode == 1 def test_use_module_path(run_reframe, user_exec_ctx): From 67db7c9dc0c2e4a05297e50c1340acac332d52de Mon Sep 17 00:00:00 2001 From: Eirini Koutsaniti Date: Mon, 26 Sep 2022 12:00:36 +0200 Subject: [PATCH 3/3] Change error message to debug --- reframe/frontend/cli.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 3c586ed806..7514f3bf78 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -1241,9 +1241,10 @@ def module_unuse(*paths): rt.modules_system.load_module(**m, force=True) except errors.EnvironError as e: printer.error( - f'could not load module {m["name"]!r} correctly' + f'could not load module {m["name"]!r} correctly; rerun ' + f'with -vv for more information' ) - printer.error(str(e)) + printer.debug(str(e)) sys.exit(1) options.flex_alloc_nodes = options.flex_alloc_nodes or 'idle'