common/build-style/python3-pep517.sh: unpack wheels for testing

Python packages built with pep517 system occasionally require
accessing distinfo files and/or entry points provided by the
package for tests to run. Since these assets are packed inside
the wheel generated in `do_build`, the target wheel is unpacked
in `do_check` first so that the said artifacts are accessible
during test runs.
This commit is contained in:
icp 2023-02-01 11:16:05 +05:30 committed by Andrew J. Hesford
parent 836dad2cfa
commit 37d268a907
1 changed files with 12 additions and 1 deletions

View File

@ -14,7 +14,18 @@ do_check() {
if python3 -c 'import xdist' >/dev/null 2>&1; then
testjobs="-n $XBPS_MAKEJOBS"
fi
${make_check_pre} python3 -m pytest ${testjobs} ${make_check_args} ${make_check_target}
if [ -z "${make_install_target}" ]; then
local wheelbase="${pkgname#python3-}"
make_install_target="dist/${wheelbase//-/_}-${version}-*-*-*.whl"
fi
local testdir="tmp/$(date +%s)"
python3 -m installer --destdir "${testdir}" \
${make_install_args} ${make_install_target}
PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" \
${make_check_pre} pytest3 ${testjobs} ${make_check_args} ${make_check_target}
else
msg_warn "Unable to determine tests for PEP517 Python templates\n"
return 0