From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1394538-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 524A9158090
	for <garchives@archives.gentoo.org>; Mon,  9 May 2022 20:33:42 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 8D20AE084A;
	Mon,  9 May 2022 20:33:39 +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))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 70CF1E084A
	for <gentoo-commits@lists.gentoo.org>; Mon,  9 May 2022 20:33:39 +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 74FE53412C4
	for <gentoo-commits@lists.gentoo.org>; Mon,  9 May 2022 20:33:08 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 088BE455
	for <gentoo-commits@lists.gentoo.org>; Mon,  9 May 2022 20:33:06 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
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" <mgorny@gentoo.org>
Message-ID: <1652128307.f77482477e16fb380a1fe29bbbf88ba9d343a1ac.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/tests/
X-VCS-Repository: repo/gentoo
X-VCS-Files: eclass/tests/python-utils-r1.sh
X-VCS-Directories: eclass/tests/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: f77482477e16fb380a1fe29bbbf88ba9d343a1ac
X-VCS-Branch: master
Date: Mon,  9 May 2022 20:33:06 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 7320f390-568a-40f6-b1a7-a71671db3b59
X-Archives-Hash: 8924c084a2a6aee01ba0da6d500b6ebc

commit:     f77482477e16fb380a1fe29bbbf88ba9d343a1ac
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May  8 10:37:57 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May  9 20:31:47 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f7748247

eclass/tests/python-utils-r1.eclass: Add tests for adding new impls

Add tests that verify that new Python implementations are added to all
the places that need them.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/tests/python-utils-r1.sh | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index d971c524b373..6abf10cadabd 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -96,6 +96,41 @@ for minor in 6 7 8 9 10 11; do
 	fi
 	test_var PYTHON_PKG_DEP "python3_${minor}" "*dev-lang/python*:3.${minor}"
 	test_var PYTHON_SCRIPTDIR "python3_${minor}" "/usr/lib/python-exec/python3.${minor}"
+
+	tbegin "Testing that python3_${minor} is present in an impl array"
+	has "python3_${minor}" "${_PYTHON_ALL_IMPLS[@]}"
+	has_in_all=${?}
+	has "python3_${minor}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
+	has_in_historical=${?}
+	if [[ ${has_in_all} -eq ${has_in_historical} ]]; then
+		if [[ ${has_in_all} -eq 1 ]]; then
+			eerror "python3_${minor} not found in _PYTHON_ALL_IMPLS or _PYTHON_HISTORICAL_IMPLS"
+		else
+			eerror "python3_${minor} listed both in _PYTHON_ALL_IMPLS and _PYTHON_HISTORICAL_IMPLS"
+		fi
+	fi
+	tend ${?}
+
+	tbegin "Testing that PYTHON_COMPAT accepts the impl"
+	(
+		# NB: we add pypy3 as we need to always have at least one
+		# non-historical impl
+		PYTHON_COMPAT=( pypy3 "python3_${minor}" )
+		_python_set_impls
+	)
+	tend ${?}
+
+	# these tests apply to py3.8+ only
+	if [[ ${minor} -ge 8 ]]; then
+		tbegin "Testing that _python_verify_patterns accepts stdlib version"
+		( _python_verify_patterns "3.${minor}" )
+		tend ${?}
+
+		tbegin "Testing _python_impl_matches on stdlib version"
+		_python_impl_matches "python3_${minor}" "3.${minor}"
+		tend ${?}
+	fi
+
 	eoutdent
 done