From f77482477e16fb380a1fe29bbbf88ba9d343a1ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sun, 8 May 2022 12:37:57 +0200 Subject: [PATCH] eclass/tests/python-utils-r1.eclass: Add tests for adding new impls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add tests that verify that new Python implementations are added to all the places that need them. Signed-off-by: Michał Górny --- 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 d971c524b373c..6abf10cadabd5 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