From e05b8d74819fa18a908ea201a86138ea3168aba9 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 23 Jan 2022 08:56:14 +1100 Subject: [PATCH 1/2] libwebp 1.2.2 fixed endian bugs --- Tests/test_file_webp_animated.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Tests/test_file_webp_animated.py b/Tests/test_file_webp_animated.py index 25ebffe0248..cf14a4527d4 100644 --- a/Tests/test_file_webp_animated.py +++ b/Tests/test_file_webp_animated.py @@ -1,6 +1,7 @@ import pytest +from packaging.version import parse as parse_version -from PIL import Image +from PIL import Image, features from .helper import ( assert_image_equal, @@ -27,7 +28,6 @@ def test_n_frames(): assert im.is_animated -@pytest.mark.xfail(is_big_endian(), reason="Fails on big-endian") def test_write_animation_L(tmp_path): """ Convert an animated GIF to animated WebP, then compare the frame count, and first @@ -46,6 +46,11 @@ def test_write_animation_L(tmp_path): orig.load() im.load() assert_image_similar(im, orig.convert("RGBA"), 32.9) + + if is_big_endian(): + webp = parse_version(features.version_module("webp")) + if webp < parse_version("1.2.2"): + return orig.seek(orig.n_frames - 1) im.seek(im.n_frames - 1) orig.load() @@ -53,7 +58,6 @@ def test_write_animation_L(tmp_path): assert_image_similar(im, orig.convert("RGBA"), 32.9) -@pytest.mark.xfail(is_big_endian(), reason="Fails on big-endian") def test_write_animation_RGB(tmp_path): """ Write an animated WebP from RGB frames, and ensure the frames @@ -69,6 +73,10 @@ def check(temp_file): assert_image_equal(im, frame1.convert("RGBA")) # Compare second frame to original + if is_big_endian(): + webp = parse_version(features.version_module("webp")) + if webp < parse_version("1.2.2"): + return im.seek(1) im.load() assert_image_equal(im, frame2.convert("RGBA")) From eb1fc4ad9f0d6eba8b2b186360cd334740f3d52f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 24 Jan 2022 07:47:44 +1100 Subject: [PATCH 2/2] Added pytest skip message --- Tests/test_file_webp_animated.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/test_file_webp_animated.py b/Tests/test_file_webp_animated.py index cf14a4527d4..8606f6aafd4 100644 --- a/Tests/test_file_webp_animated.py +++ b/Tests/test_file_webp_animated.py @@ -50,7 +50,7 @@ def test_write_animation_L(tmp_path): if is_big_endian(): webp = parse_version(features.version_module("webp")) if webp < parse_version("1.2.2"): - return + pytest.skip("Fails with libwebp earlier than 1.2.2") orig.seek(orig.n_frames - 1) im.seek(im.n_frames - 1) orig.load() @@ -76,7 +76,7 @@ def check(temp_file): if is_big_endian(): webp = parse_version(features.version_module("webp")) if webp < parse_version("1.2.2"): - return + pytest.skip("Fails with libwebp earlier than 1.2.2") im.seek(1) im.load() assert_image_equal(im, frame2.convert("RGBA"))