Skip to content

Commit 7a787a0

Browse files
committed
Skip tests when not on linux
1 parent d436178 commit 7a787a0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/test_image.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
TOOSMALL_PNG = os.path.join(IMAGE_ROOT, "toosmall_png")
4242
IS_WINDOWS = sys.platform in ("win32", "cygwin")
4343
IS_MACOS = sys.platform == "darwin"
44+
IS_LINUX = sys.platform == "linux"
4445
PILLOW_VERSION = tuple(int(x) for x in PILLOW_VERSION.split("."))
4546
WEBP_TEST_IMAGES_DIR = os.environ.get("WEBP_TEST_IMAGES_DIR", "")
4647
# See https://github.com/pytorch/vision/pull/8724#issuecomment-2503964558
@@ -859,8 +860,8 @@ def test_decode_gif(tmpdir, name, scripted):
859860
(decode_jpeg, "Not a JPEG file"),
860861
(decode_gif, re.escape("DGifOpenFileName() failed - 103")),
861862
(decode_webp, "WebPGetFeatures failed."),
862-
(decode_avif, "BMFF parsing failed"),
863-
(decode_heic, "Invalid input: No 'ftyp' box"),
863+
pytest.param(decode_avif, "BMFF parsing failed", marks=pytest.mark.skipif(not IS_LINUX)),
864+
pytest.param(decode_heic, "Invalid input: No 'ftyp' box", marks=pytest.mark.skipif(not IS_LINUX)),
864865
],
865866
)
866867
def test_decode_bad_encoded_data(decode_fun, match):
@@ -919,6 +920,7 @@ def test_decode_webp_against_pil(decode_fun, scripted, mode, pil_mode, filename)
919920

920921

921922
# TODO_AVIF_HEIC make decode_image work
923+
@pytest.mark.skipif(not IS_LINUX)
922924
# @pytest.mark.parametrize("decode_fun", (decode_avif, decode_image))
923925
@pytest.mark.parametrize("decode_fun", (decode_avif,))
924926
def test_decode_avif(decode_fun):
@@ -931,6 +933,7 @@ def test_decode_avif(decode_fun):
931933

932934
# Note: decode_image fails because some of these files have a (valid) signature
933935
# we don't recognize. We should probably use libmagic....
936+
@pytest.mark.skipif(not IS_LINUX)
934937
@pytest.mark.parametrize("decode_fun", (decode_avif, decode_heic))
935938
@pytest.mark.parametrize(
936939
"mode, pil_mode",
@@ -1008,6 +1011,7 @@ def test_decode_avif_heic_against_pil(decode_fun, mode, pil_mode, filename):
10081011

10091012
# TODO_AVIF_HEIC make decode_image work
10101013
# @pytest.mark.parametrize("decode_fun", (decode_heic, decode_image))
1014+
@pytest.mark.skipif(not IS_LINUX)
10111015
@pytest.mark.parametrize("decode_fun", (decode_heic,))
10121016
def test_decode_heic(decode_fun):
10131017
encoded_bytes = read_file(next(get_images(FAKEDATA_DIR, ".heic")))

0 commit comments

Comments
 (0)