From 03e4079af74fa25ad894e1f46a061b6c2f6d630f Mon Sep 17 00:00:00 2001 From: Andrei Matveyeu Date: Mon, 27 May 2024 12:27:41 +0200 Subject: [PATCH] Subsuite status FAILED based on verdict/outcome --- .../src/etos_suite_runner/lib/suite.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/projects/etos_suite_runner/src/etos_suite_runner/lib/suite.py b/projects/etos_suite_runner/src/etos_suite_runner/lib/suite.py index 9a3284a..a554d49 100644 --- a/projects/etos_suite_runner/src/etos_suite_runner/lib/suite.py +++ b/projects/etos_suite_runner/src/etos_suite_runner/lib/suite.py @@ -47,7 +47,8 @@ class SubSuite(OpenTelemetryBase): # pylint:disable=too-many-instance-attribute """Handle test results and tracking of a single sub suite.""" released = False - failed = False + _failed = False + _failed_flag_set = False def __init__(self, etos: ETOS, environment: dict, main_suite_id: str) -> None: """Initialize a sub suite.""" @@ -60,6 +61,21 @@ def __init__(self, etos: ETOS, environment: dict, main_suite_id: str) -> None: self.test_suite_started = {} self.test_suite_finished = {} + @property + def failed(self) -> bool: + """Property indicating whether the sub-suite has had failures.""" + if self._failed_flag_set: + return self._failed + verdict = self.outcome().get("verdict") + conclusion = self.outcome().get("conclusion") + return "FAILED" in (verdict, conclusion) + + @failed.setter + def failed(self, value: bool) -> None: + """Setter for the 'failed' property.""" + self._failed = value + self._failed_flag_set = True + @property def finished(self) -> bool: """Whether or not this sub suite has finished."""