[pim/akonadi-e2e-tests] /: Add scaffolding to rerun failed tests

Kevin Ottens <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit b54a207af2997098c0aa4d31b8e05e2f8760b5ab by Kevin Ottens.
Committed on 30/07/2026 at 15:36.
Pushed by ervin into branch 'master'.

Add scaffolding to rerun failed tests

Unlike pytest plugins, we let the test suite complete and then only pick
the failed tests for rerun. Hopefully should filter out enough for the
CI.

M  +1    -1    Makefile
A  +33   -0    run-tests.sh

https://invent.kde.org/pim/akonadi-e2e-tests/-/commit/b54a207af2997098c0aa4d31b8e05e2f8760b5ab

diff --git a/Makefile b/Makefile
index 42d73cc..922760b 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ init:
 	uv sync
 
 test:
-	uv run pytest -n 4 tests/
+	./run-tests.sh
 
 docker:
 	make -C docker
diff --git a/run-tests.sh b/run-tests.sh
new file mode 100755
index 0000000..4e3bc23
--- /dev/null
+++ b/run-tests.sh
@@ -0,0 +1,33 @@
+#! /usr/bin/bash
+# SPDX-FileCopyrightText: Kevin Ottens <[email protected]>
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+MAX_RERUN=5
+PYTEST_ARGS="-n 4 tests/"
+
+uv run pytest $PYTEST_ARGS
+
+if [ "$?" == "0" ]; then
+    exit 0
+fi
+
+rerun=1
+while [ $rerun -le $MAX_RERUN ]; do
+
+    echo ""
+    echo "================================"
+    echo "Had some test failures, rerun $rerun"
+    echo "================================"
+    echo ""
+
+    uv run pytest --lf $PYTEST_ARGS
+    if [ "$?" == "0" ]; then
+        exit 0
+    fi
+
+    ((rerun = rerun + 1))
+done
+
+# We had only failures bailing out
+echo "All reruns failed! ;-("
+exit 1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.