• [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: Add EPYTEST_RERUNS

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Tue Jul 22 08:10:01 2025
    Add EPYTEST_RERUNS variable to enable pytest-rerunfailures with
    a specified rerun count. This should provide a more streamlined
    approach to handling flaky test suites.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 3 +++
    eclass/python-utils-r1.eclass | 22 ++++++++++++++++++++++
    2 files changed, 25 insertions(+)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 7b025261eb2b..c59bdce17581 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -554,6 +554,9 @@ distutils_enable_tests() {
    ;&
    pytest)
    test_pkgs+=' >=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
    + if [[ -n ${EPYTEST_RERUNS} ]]; then
    + test_pkgs+=' dev-python/pytest-rerunfailures[${PYTHON_USEDEP}]'
    + fi
    if [[ -n ${EPYTEST_TIMEOUT} ]]; then
    test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]'
    fi
    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 9cdfdc87019f..13ed87501200 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1354,6 +1354,16 @@ _set_epytest_plugins() {
    fi
    }

    +# @ECLASS_VARIABLE: EPYTEST_RERUNS
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# If set t