11import pytest
2+ from packaging .version import parse as parse_version
23
3- from PIL import Image
4+ from PIL import Image , features
45
56from .helper import (
67 assert_image_equal ,
@@ -27,7 +28,6 @@ def test_n_frames():
2728 assert im .is_animated
2829
2930
30- @pytest .mark .xfail (is_big_endian (), reason = "Fails on big-endian" )
3131def test_write_animation_L (tmp_path ):
3232 """
3333 Convert an animated GIF to animated WebP, then compare the frame count, and first
@@ -46,14 +46,18 @@ def test_write_animation_L(tmp_path):
4646 orig .load ()
4747 im .load ()
4848 assert_image_similar (im , orig .convert ("RGBA" ), 32.9 )
49+
50+ if is_big_endian ():
51+ webp = parse_version (features .version_module ("webp" ))
52+ if webp < parse_version ("1.2.2" ):
53+ pytest .skip ("Fails with libwebp earlier than 1.2.2" )
4954 orig .seek (orig .n_frames - 1 )
5055 im .seek (im .n_frames - 1 )
5156 orig .load ()
5257 im .load ()
5358 assert_image_similar (im , orig .convert ("RGBA" ), 32.9 )
5459
5560
56- @pytest .mark .xfail (is_big_endian (), reason = "Fails on big-endian" )
5761def test_write_animation_RGB (tmp_path ):
5862 """
5963 Write an animated WebP from RGB frames, and ensure the frames
@@ -69,6 +73,10 @@ def check(temp_file):
6973 assert_image_equal (im , frame1 .convert ("RGBA" ))
7074
7175 # Compare second frame to original
76+ if is_big_endian ():
77+ webp = parse_version (features .version_module ("webp" ))
78+ if webp < parse_version ("1.2.2" ):
79+ pytest .skip ("Fails with libwebp earlier than 1.2.2" )
7280 im .seek (1 )
7381 im .load ()
7482 assert_image_equal (im , frame2 .convert ("RGBA" ))
0 commit comments