public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 5/7] distutils-r1.eclass: Refactor `distutils_enable_tests pytest`
Date: Tue, 26 Mar 2024 19:25:43 +0100	[thread overview]
Message-ID: <20240326182545.247160-5-mgorny@gentoo.org> (raw)
In-Reply-To: <20240326182545.247160-1-mgorny@gentoo.org>

Refactor `distutils_enable_tests pytest` to move `test_pkgs` logic
straight into pytest block, as it is not used by any other variant
anymore.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 44553f8da6f3..a1617999a037 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -606,16 +606,23 @@ distutils_enable_tests() {
 	[[ ${#} -eq 1 ]] || die "${FUNCNAME} takes exactly one argument: test-runner"
 
 	local test_deps=${RDEPEND}
-	local test_pkgs
 	case ${1} in
 		pytest)
-			test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
+			local test_pkgs='>=dev-python/pytest-7.4.4[${PYTHON_USEDEP}]'
 			if [[ -n ${EPYTEST_TIMEOUT} ]]; then
 				test_pkgs+=' dev-python/pytest-timeout[${PYTHON_USEDEP}]'
 			fi
 			if [[ ${EPYTEST_XDIST} ]]; then
 				test_pkgs+=' dev-python/pytest-xdist[${PYTHON_USEDEP}]'
 			fi
+
+			if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+				test_deps+=" ${test_pkgs//'${PYTHON_USEDEP}'/${PYTHON_USEDEP}}"
+			else
+				test_deps+=" $(python_gen_cond_dep "
+					${test_pkgs}
+				")"
+			fi
 			;;
 		setup.py)
 			;;
@@ -634,15 +641,6 @@ distutils_enable_tests() {
 	_DISTUTILS_TEST_RUNNER=${1}
 	python_test() { distutils-r1_python_test; }
 
-	if [[ -n ${test_pkgs} ]]; then
-		if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
-			test_deps+=" ${test_pkgs//'${PYTHON_USEDEP}'/${PYTHON_USEDEP}}"
-		else
-			test_deps+=" $(python_gen_cond_dep "
-				${test_pkgs}
-			")"
-		fi
-	fi
 	if [[ -n ${test_deps} ]]; then
 		IUSE+=" test"
 		RESTRICT+=" !test? ( test )"
-- 
2.44.0



  parent reply	other threads:[~2024-03-26 18:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 18:25 [gentoo-dev] [PATCH 1/7] distutils-r1.eclass: Bump minimal dep versions Michał Górny
2024-03-26 18:25 ` [gentoo-dev] [PATCH 2/7] distutils-r1.eclass: Run pdm.pep517.api via pdm-backend Michał Górny
2024-03-26 18:25 ` [gentoo-dev] [PATCH 3/7] dev-python/jsonref: Use pdm-backend Michał Górny
2024-03-26 18:25 ` [gentoo-dev] [PATCH 4/7] distutils-r1.eclass: Remove nosetests support Michał Górny
2024-03-26 18:25 ` Michał Górny [this message]
2024-03-26 18:25 ` [gentoo-dev] [PATCH 6/7] distutils-r1.eclass: Fix `det unittest` with 3.12 only Michał Górny
2024-03-26 18:25 ` [gentoo-dev] [PATCH 7/7] distutils-r1.eclass: Remove more junk from .dist-info Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240326182545.247160-5-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox