From 8d2a754ce05cbb8193b761b39e4a7bcad51ba910 Mon Sep 17 00:00:00 2001 From: Lili Nie Date: Fri, 9 Aug 2024 12:17:24 -0400 Subject: [PATCH 1/3] Raise error when the workdir of runs doesn't exit --- tmt/utils/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tmt/utils/__init__.py b/tmt/utils/__init__.py index 222a535aae..37f96a9273 100644 --- a/tmt/utils/__init__.py +++ b/tmt/utils/__init__.py @@ -4518,6 +4518,9 @@ def generate_runs( run_path = Path(id_name) if '/' not in id_name: run_path = path / run_path + if not run_path.exists(): + raise tmt.utils.GeneralError( + f"Directory '{run_path}' does not exist, ") if run_path.is_absolute() and run_path.exists(): yield run_path else: From 01f4fb718393c330f6a5312b1e535108e1d62470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Thu, 9 Jan 2025 14:26:29 +0100 Subject: [PATCH 2/3] Fix unfinished error message --- tmt/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmt/utils/__init__.py b/tmt/utils/__init__.py index 37f96a9273..7b3e7e1b2d 100644 --- a/tmt/utils/__init__.py +++ b/tmt/utils/__init__.py @@ -4520,7 +4520,7 @@ def generate_runs( run_path = path / run_path if not run_path.exists(): raise tmt.utils.GeneralError( - f"Directory '{run_path}' does not exist, ") + f"Directory '{run_path}' does not exist.") if run_path.is_absolute() and run_path.exists(): yield run_path else: From 65c7e17dbc97f8cbc1be3a8e4a5be9bb0ddfc955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pl=C3=ADchal?= Date: Thu, 9 Jan 2025 16:39:18 +0100 Subject: [PATCH 3/3] Adjust the expected exit code in test --- tests/status/base/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/status/base/test.sh b/tests/status/base/test.sh index 0f398f57d5..bfeb56bf87 100755 --- a/tests/status/base/test.sh +++ b/tests/status/base/test.sh @@ -38,7 +38,7 @@ rlJournalStart rlLog "There should be the heading and one run" rlAssertGrep "2" "lines" - rlRun "tmt status -i /not/a/valid/runid | tee output" 0 "Invalid ID" + rlRun "tmt status -i /not/a/valid/runid | tee output" 2 "Invalid ID" rlRun "wc -l output | tee lines" 0 "Get the number of lines" rlLog "There should only be the heading" rlAssertGrep "1" "lines"