summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-05-08 12:37:57 +0200
committerMichał Górny <mgorny@gentoo.org>2022-05-09 22:31:47 +0200
commitf77482477e16fb380a1fe29bbbf88ba9d343a1ac (patch)
tree719d8f2da47fc806e6bb4437a23a7ebecbe9fcc1 /eclass/tests
parenteclass/tests/python-utils-r1.sh: Streamline the tests (diff)
downloadgentoo-f77482477e16fb380a1fe29bbbf88ba9d343a1ac.tar.gz
gentoo-f77482477e16fb380a1fe29bbbf88ba9d343a1ac.tar.bz2
gentoo-f77482477e16fb380a1fe29bbbf88ba9d343a1ac.zip
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@gentoo.org>
Diffstat (limited to 'eclass/tests')
-rwxr-xr-xeclass/tests/python-utils-r1.sh35
1 files changed, 35 insertions, 0 deletions
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