From e48343d4ee8cbc6724823dc0eac9ac0967251e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gull=C3=B3n?= Date: Wed, 19 Jun 2024 10:40:04 +0200 Subject: [PATCH] Skip RF test with PreRunModifier flag --- test/resources/SkipTests.py | 25 +++++++++++++++++++++++++ test/run.sh | 9 +++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 test/resources/SkipTests.py diff --git a/test/resources/SkipTests.py b/test/resources/SkipTests.py new file mode 100644 index 0000000000..97355ec3b4 --- /dev/null +++ b/test/resources/SkipTests.py @@ -0,0 +1,25 @@ +"""Pre-run modifier that skips tests by their name. +Tests to skip are specified by Test Name +""" + +import os +from robot.api import SuiteVisitor + + +class SkipTests(SuiteVisitor): + + def __init__(self, list_skip_test): + self.list_skip_test = list_skip_test + + if self.list_skip_test: + print("List of tests to be skipped:") + print(f" - {self.list_skip_test.replace(',', f'{os.linesep} - ')}") + else: + print("No tests to be skipped") + + def visit_test(self, test): + """Set tag to skip tests""" + + # set `robot:skip` tag + if test.name in self.list_skip_test.split(","): + test.tags.add("robot:skip") diff --git a/test/run.sh b/test/run.sh index 5a9e7dfa59..570171366c 100755 --- a/test/run.sh +++ b/test/run.sh @@ -15,7 +15,7 @@ OUTDIR="${ROOTDIR}/_output/e2e-$(date +%Y%m%d-%H%M%S)" function usage { local -r script_name=$(basename "$0") cat - <