From be29b1b6a984551bb74e97f54d693d5faa7d583d Mon Sep 17 00:00:00 2001 From: Ahmed Ismail Date: Fri, 17 May 2024 17:24:52 +0100 Subject: [PATCH] python-tests: Exit test from one point It is always better to have a single return/exit from a function/test in which it would be easier for users to understand. Signed-off-by: Ahmed Ismail --- tools/tests/test_applications.py | 3 ++- tools/tests/test_blinky_output.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/tests/test_applications.py b/tools/tests/test_applications.py index f8b2e725..890c629e 100755 --- a/tools/tests/test_applications.py +++ b/tools/tests/test_applications.py @@ -69,7 +69,8 @@ def test_applications( if index == len(pass_output): break for x in fail_output: - assert x not in line + if x in line: + break current_time = timer() assert index == len(pass_output) diff --git a/tools/tests/test_blinky_output.py b/tools/tests/test_blinky_output.py index 32aa5657..83d3881b 100644 --- a/tools/tests/test_blinky_output.py +++ b/tools/tests/test_blinky_output.py @@ -45,7 +45,8 @@ def test_blinky_output( if index == len(pass_output): break for x in fail_output: - assert x not in line + if x in line: + break current_time = timer() assert index == len(pass_output)