Merge pull request #150 from radarhere/features

Test features
This commit is contained in:
Hugo van Kemenade 2020-06-08 17:17:40 +03:00 committed by GitHub
commit 1623504957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,14 +74,17 @@ function run_tests_in_repo {
EXP_CODECS="jpg jpg_2000 libtiff zlib" EXP_CODECS="jpg jpg_2000 libtiff zlib"
EXP_MODULES="freetype2 littlecms2 pil tkinter webp" EXP_MODULES="freetype2 littlecms2 pil tkinter webp"
EXP_FEATURES="transp_webp webp_anim webp_mux"
if [ -n "$IS_OSX" ]; then
EXP_FEATURES="$EXP_FEATURES xcb"
fi
function run_tests { function run_tests {
# Runs tests on installed distribution from an empty directory # Runs tests on installed distribution from an empty directory
(cd ../Pillow && run_tests_in_repo) (cd ../Pillow && run_tests_in_repo)
# Show supported codecs and modules # Test against expected codecs, modules and features
local codecs=$(python -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))')
# Test against expected codecs and modules
local ret=0 local ret=0
local codecs=$(python -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))')
if [ "$codecs" != "$EXP_CODECS" ]; then if [ "$codecs" != "$EXP_CODECS" ]; then
echo "Codecs should be: '$EXP_CODECS'; but are '$codecs'" echo "Codecs should be: '$EXP_CODECS'; but are '$codecs'"
ret=1 ret=1
@ -91,5 +94,10 @@ function run_tests {
echo "Modules should be: '$EXP_MODULES'; but are '$modules'" echo "Modules should be: '$EXP_MODULES'; but are '$modules'"
ret=1 ret=1
fi fi
local features=$(python -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'"
ret=1
fi
return $ret return $ret
} }