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
"@pytest.mark.flaky" will get rerun only once.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
Part-of: https://github.com/gentoo/gentoo/pull/44172
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny 2025-10-14 08:54:55 +02:00
parent cfa5bab4eb
commit ddda228a67
No known key found for this signature in database
GPG Key ID: 639ADAE2329E240E

View File

@ -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