diff --git a/scripts/pylib/twister/twisterlib/statuses.py b/scripts/pylib/twister/twisterlib/statuses.py index 2983917467f4f4..c5545b3fe28b89 100644 --- a/scripts/pylib/twister/twisterlib/statuses.py +++ b/scripts/pylib/twister/twisterlib/statuses.py @@ -23,18 +23,17 @@ def _missing_(cls, value): @staticmethod def get_color(status: TwisterStatus) -> str: - match(status): - case TwisterStatus.PASS: - color = Fore.GREEN - case TwisterStatus.SKIP | TwisterStatus.FILTER | TwisterStatus.BLOCK: - color = Fore.YELLOW - case TwisterStatus.FAIL | TwisterStatus.ERROR: - color = Fore.RED - case TwisterStatus.STARTED | TwisterStatus.NONE: - color = Fore.MAGENTA - case _: - color = Fore.RESET - return color + status2color = { + TwisterStatus.PASS: Fore.GREEN, + TwisterStatus.SKIP: Fore.YELLOW, + TwisterStatus.FILTER: Fore.YELLOW, + TwisterStatus.BLOCK: Fore.YELLOW, + TwisterStatus.FAIL: Fore.RED, + TwisterStatus.ERROR: Fore.RED, + TwisterStatus.STARTED: Fore.MAGENTA, + TwisterStatus.NONE: Fore.MAGENTA + } + return status2color[status] if status in status2color else Fore.RESET # All statuses below this comment can be used for TestCase BLOCK = 'blocked'