commit:     ddda228a67a145f1baed788b5a605dc382ddc9a9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 14 06:54:55 2025 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Oct 23 18:19:12 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddda228a

python-utils-r1.eclass: Use --force-reruns for EPYTEST_RERUNS

Use "--force-reruns" rather than "--reruns" when available.  This
ensures that the rerun count is respected for all tests, including
tests already marked upstream for reruns.  Otherwise tests marked
" <AT> pytest.mark.flaky" will get rerun only once.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/44172
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index e213273a3a78..b08dbd586ba8 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1538,9 +1538,17 @@ epytest() {
                        )
                fi
 
-               args+=(
-                       "--reruns=${EPYTEST_RERUNS}"
-               )
+               if has_version ">=dev-python/pytest-rerunfailures-16.1"; then
+                       args+=(
+                               # --reruns only adds N reruns for tests not 
marked for reruns
+                               # --force-reruns overrides the rerun count for 
all tests
+                               "--force-reruns=${EPYTEST_RERUNS}"
+                       )
+               else
+                       args+=(
+                               "--reruns=${EPYTEST_RERUNS}"
+                       )
+               fi
        fi
 
        if [[ -n ${EPYTEST_TIMEOUT} ]]; then

Reply via email to