From eb36237ae72936b8b6f4ee25a942418325af67dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gull=C3=B3n?= Date: Fri, 10 May 2024 12:28:04 +0200 Subject: [PATCH 1/4] 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..8bb68ddfc3 --- /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 +""" + +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(',', '\n - ')}") + 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 d31b6ee2a3..8547beb5c3 100755 --- a/test/run.sh +++ b/test/run.sh @@ -14,7 +14,7 @@ OUTDIR="${ROOTDIR}/_output/e2e-$(date +%Y%m%d-%H%M%S)" function usage { local -r script_name=$(basename "$0") cat - < Date: Fri, 10 May 2024 13:20:41 +0200 Subject: [PATCH 2/4] fix verify-py error E999 SyntaxError: f-string expression part cannot include a backslash --- test/resources/SkipTests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/resources/SkipTests.py b/test/resources/SkipTests.py index 8bb68ddfc3..ea872cafed 100644 --- a/test/resources/SkipTests.py +++ b/test/resources/SkipTests.py @@ -3,6 +3,7 @@ Tests to skip are specified by Test Name """ +import os from robot.api import SuiteVisitor @@ -13,7 +14,7 @@ def __init__(self, list_skip_test): if self.list_skip_test: print("List of tests to be skipped:") - print(f" - {self.list_skip_test.replace(',', '\n - ')}") + print(f" - {self.list_skip_test.replace(',', f'{os.linesep} - ')}") else: print("No tests to be skipped") From 652bdb46a5fe0ea17cf92791b71701124bd0f787 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gull=C3=B3n?= Date: Fri, 10 May 2024 16:33:03 +0200 Subject: [PATCH 3/4] update usage description --- test/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/run.sh b/test/run.sh index 8547beb5c3..84e2b43a3f 100755 --- a/test/run.sh +++ b/test/run.sh @@ -23,8 +23,8 @@ Options: -o DIR The output directory. (${OUTDIR}) -v DIR The venv directory. (${RF_VENV}) -i PATH The variables file. (${RF_VARIABLES}) - -s NAME=VALUE To enable an stress condition. - -k SKIP_TESTS List of Tests to skip. + -s NAME=VALUE To enable a stress condition. + -k SKIP_TESTS Comma separated list of tests to skip. EOF } From 6279bb298952754d11d72b2f5ca89ec3c8fcb704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gull=C3=B3n?= Date: Fri, 10 May 2024 16:39:27 +0200 Subject: [PATCH 4/4] set fullpath for SkipTests.py --- test/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run.sh b/test/run.sh index 84e2b43a3f..4d4a58a469 100755 --- a/test/run.sh +++ b/test/run.sh @@ -105,7 +105,7 @@ else # shellcheck disable=SC2086 "${RF_BINARY}" \ --randomize all \ - --prerunmodifier resources/SkipTests.py:${SKIP_TESTS:-} \ + --prerunmodifier "${SCRIPTDIR}/resources/SkipTests.py:${SKIP_TESTS:-}" \ --loglevel TRACE \ -V "${RF_VARIABLES}" \ -x junit.xml \