Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 3/6] eclass/tests/python-utils-r1.eclass: Add tests for adding new impls
Date: Sun, 08 May 2022 18:27:54
Message-Id: 20220508182642.4112-4-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] python-utils-r1.eclass: Python 3.11 support by "Michał Górny"
1 Add tests that verify that new Python implementations are added to all
2 the places that need them.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/tests/python-utils-r1.sh | 35 +++++++++++++++++++++++++++++++++
7 1 file changed, 35 insertions(+)
8
9 diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
10 index d971c524b373..6abf10cadabd 100755
11 --- a/eclass/tests/python-utils-r1.sh
12 +++ b/eclass/tests/python-utils-r1.sh
13 @@ -96,6 +96,41 @@ for minor in 6 7 8 9 10 11; do
14 fi
15 test_var PYTHON_PKG_DEP "python3_${minor}" "*dev-lang/python*:3.${minor}"
16 test_var PYTHON_SCRIPTDIR "python3_${minor}" "/usr/lib/python-exec/python3.${minor}"
17 +
18 + tbegin "Testing that python3_${minor} is present in an impl array"
19 + has "python3_${minor}" "${_PYTHON_ALL_IMPLS[@]}"
20 + has_in_all=${?}
21 + has "python3_${minor}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
22 + has_in_historical=${?}
23 + if [[ ${has_in_all} -eq ${has_in_historical} ]]; then
24 + if [[ ${has_in_all} -eq 1 ]]; then
25 + eerror "python3_${minor} not found in _PYTHON_ALL_IMPLS or _PYTHON_HISTORICAL_IMPLS"
26 + else
27 + eerror "python3_${minor} listed both in _PYTHON_ALL_IMPLS and _PYTHON_HISTORICAL_IMPLS"
28 + fi
29 + fi
30 + tend ${?}
31 +
32 + tbegin "Testing that PYTHON_COMPAT accepts the impl"
33 + (
34 + # NB: we add pypy3 as we need to always have at least one
35 + # non-historical impl
36 + PYTHON_COMPAT=( pypy3 "python3_${minor}" )
37 + _python_set_impls
38 + )
39 + tend ${?}
40 +
41 + # these tests apply to py3.8+ only
42 + if [[ ${minor} -ge 8 ]]; then
43 + tbegin "Testing that _python_verify_patterns accepts stdlib version"
44 + ( _python_verify_patterns "3.${minor}" )
45 + tend ${?}
46 +
47 + tbegin "Testing _python_impl_matches on stdlib version"
48 + _python_impl_matches "python3_${minor}" "3.${minor}"
49 + tend ${?}
50 + fi
51 +
52 eoutdent
53 done
54
55 --
56 2.35.1