mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Only skip test if libimagequant is earlier than 4 on ppc64le
This commit is contained in:
parent
cac305f8d2
commit
45534d130b
|
@ -1,8 +1,9 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
from packaging.version import parse as parse_version
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image, features
|
||||||
|
|
||||||
from .helper import assert_image_similar, hopper, is_ppc64le
|
from .helper import assert_image_similar, hopper, is_ppc64le, skip_unless_feature
|
||||||
|
|
||||||
|
|
||||||
def test_sanity():
|
def test_sanity():
|
||||||
|
@ -17,16 +18,14 @@ def test_sanity():
|
||||||
assert_image_similar(converted.convert("RGB"), image, 60)
|
assert_image_similar(converted.convert("RGB"), image, 60)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(is_ppc64le(), reason="failing on ppc64le on GHA")
|
@skip_unless_feature("libimagequant")
|
||||||
def test_libimagequant_quantize():
|
def test_libimagequant_quantize():
|
||||||
image = hopper()
|
image = hopper()
|
||||||
try:
|
if is_ppc64le():
|
||||||
converted = image.quantize(100, Image.LIBIMAGEQUANT)
|
libimagequant = parse_version(features.version_feature("libimagequant"))
|
||||||
except ValueError as ex: # pragma: no cover
|
if libimagequant < parse_version("4"):
|
||||||
if "dependency" in str(ex).lower():
|
pytest.skip("Fails with libimagequant earlier than 4.0.0 on ppc64le")
|
||||||
pytest.skip("libimagequant support not available")
|
converted = image.quantize(100, Image.LIBIMAGEQUANT)
|
||||||
else:
|
|
||||||
raise
|
|
||||||
assert converted.mode == "P"
|
assert converted.mode == "P"
|
||||||
assert_image_similar(converted.convert("RGB"), image, 15)
|
assert_image_similar(converted.convert("RGB"), image, 15)
|
||||||
assert len(converted.getcolors()) == 100
|
assert len(converted.getcolors()) == 100
|
||||||
|
|
Loading…
Reference in New Issue
Block a user