From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2CDA915808A for ; Fri, 25 Jul 2025 05:57:07 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 11FAB33BEFF for ; Fri, 25 Jul 2025 05:57:07 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 0B63311055E; Fri, 25 Jul 2025 05:57:06 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id F073711055E for ; Fri, 25 Jul 2025 05:57:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9EB9F33BEFF for ; Fri, 25 Jul 2025 05:57:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AC5B31686 for ; Fri, 25 Jul 2025 05:57:03 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1753423004.87a034bd840d2d9095bccb29e7cc0922ec29b4ad.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/distutils-r1.eclass eclass/python-utils-r1.eclass X-VCS-Directories: eclass/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 87a034bd840d2d9095bccb29e7cc0922ec29b4ad X-VCS-Branch: master Date: Fri, 25 Jul 2025 05:57:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1b1e1f7b-6971-438d-9cd2-b7dde2e4733b X-Archives-Hash: db599a306c41dcdf7143c7b14ccf7a35 commit: 87a034bd840d2d9095bccb29e7cc0922ec29b4ad Author: Michał Górny gentoo org> AuthorDate: Mon Jul 21 12:40:20 2025 +0000 Commit: Michał Górny gentoo org> CommitDate: Fri Jul 25 05:56:44 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=87a034bd python-utils-r1.eclass: Add EPYTEST_RERUNS 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 gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/43094 Signed-off-by: Michał Górny 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 to a non-empty value, enables pytest-rerunfailures plugin +# and sets rerun count to the specified value. This variable can be +# either set in ebuilds with flaky tests, or by user to try if it helps. +# If this variable is set prior to calling distutils_enable_tests +# in distutils-r1, a test dependency on dev-python/pytest-rerunfailures +# is added automatically. + # @ECLASS_VARIABLE: EPYTEST_TIMEOUT # @DEFAULT_UNSET # @DESCRIPTION: @@ -1517,6 +1527,18 @@ epytest() { ) fi + if [[ -n ${EPYTEST_RERUNS} ]]; then + if [[ ${PYTEST_PLUGINS} != *pytest_rerunfailures* ]]; then + args+=( + -p rerunfailures + ) + fi + + args+=( + "--reruns=${EPYTEST_RERUNS}" + ) + fi + if [[ -n ${EPYTEST_TIMEOUT} ]]; then if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then args+=(