From f55877916b60f2d64a1041cffc0b288998c75b3d Mon Sep 17 00:00:00 2001 From: skycastlelily Date: Thu, 9 Jan 2025 14:16:54 -0500 Subject: [PATCH] Raise error when the workdir of runs doesn't exist (#2805) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Petr Šplíchal --- tests/status/base/test.sh | 2 +- tmt/utils/__init__.py | 3 +++ 2 files changed, 4 insertions(+), 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" diff --git a/tmt/utils/__init__.py b/tmt/utils/__init__.py index 222a535aae..7b3e7e1b2d 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: