From e6a4b058e68db1930ad595f507dc99bf5cab555d Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 14 Nov 2023 13:47:45 +1100 Subject: [PATCH] testwheels --- .github/workflows/wheels-test.sh | 41 ++++++++++++++++++++++++++++++++ pyproject.toml | 2 ++ 2 files changed, 43 insertions(+) create mode 100755 .github/workflows/wheels-test.sh diff --git a/.github/workflows/wheels-test.sh b/.github/workflows/wheels-test.sh new file mode 100755 index 00000000000..fd622412bc1 --- /dev/null +++ b/.github/workflows/wheels-test.sh @@ -0,0 +1,41 @@ +EXP_CODECS="jpg jpg_2000 libtiff zlib" +EXP_MODULES="freetype2 littlecms2 pil tkinter webp" +EXP_FEATURES="fribidi harfbuzz libjpeg_turbo raqm transp_webp webp_anim webp_mux xcb" + +if [[ "$OSTYPE" == "darwin"* ]]; then + brew install fribidi + export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig" +elif [ "${AUDITWHEEL_POLICY:9}" == "musllinux" ]; then + apk add curl fribidi +else + apt-get update + apt-get install -y libfribidi0 libopenblas-dev pkg-config +fi +if [ "${AUDITWHEEL_POLICY:9}" != "musllinux" ]; then + python3 -m pip install numpy +fi + +curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip +unzip pillow-test-images.zip +mv test-images-main/* Tests/images + +# Runs tests +python3 selftest.py +python3 -m pytest + +# Test against expected codecs, modules and features +codecs=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))') +if [ "$codecs" != "$EXP_CODECS" ]; then + echo "Codecs should be: '$EXP_CODECS'; but are '$codecs'" + exit 1 +fi +modules=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_modules())))') +if [ "$modules" != "$EXP_MODULES" ]; then + echo "Modules should be: '$EXP_MODULES'; but are '$modules'" + exit 1 +fi +features=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_features())))') +if [ "$features" != "$EXP_FEATURES" ]; then + echo "Features should be: '$EXP_FEATURES'; but are '$features'" + exit 1 +fi diff --git a/pyproject.toml b/pyproject.toml index 6599220ff17..3a72107856c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,6 +71,8 @@ Twitter = "https://twitter.com/PythonPillow" [tool.cibuildwheel] before-all = ".github/workflows/wheels-dependencies.sh" +test-command = "cd {project} && .github/workflows/wheels-test.sh" +test-extras = "tests" [tool.setuptools] packages = ["PIL"]