4545PILLOW_VERSION  =  tuple (int (x ) for  x  in  PILLOW_VERSION .split ("." ))
4646WEBP_TEST_IMAGES_DIR  =  os .environ .get ("WEBP_TEST_IMAGES_DIR" , "" )
4747# See https://github.com/pytorch/vision/pull/8724#issuecomment-2503964558 
48- ROCM_WEBP_MESSAGE  =  "ROCM not built with webp support ." 
48+ HEIC_AVIF_MESSAGE  =  "AVIF and HEIF only available on linux ." 
4949
5050
5151def  _get_safe_image_name (name ):
@@ -860,8 +860,8 @@ def test_decode_gif(tmpdir, name, scripted):
860860        (decode_jpeg , "Not a JPEG file" ), 
861861        (decode_gif , re .escape ("DGifOpenFileName() failed - 103" )), 
862862        (decode_webp , "WebPGetFeatures failed." ), 
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 )), 
863+         pytest .param (decode_avif , "BMFF parsing failed" , marks = pytest .mark .skipif (not  IS_LINUX ,  reason = HEIC_AVIF_MESSAGE )), 
864+         pytest .param (decode_heic , "Invalid input: No 'ftyp' box" , marks = pytest .mark .skipif (not  IS_LINUX ,  reason = HEIC_AVIF_MESSAGE )), 
865865    ], 
866866) 
867867def  test_decode_bad_encoded_data (decode_fun , match ):
@@ -920,7 +920,7 @@ def test_decode_webp_against_pil(decode_fun, scripted, mode, pil_mode, filename)
920920
921921
922922# TODO_AVIF_HEIC make decode_image work 
923- @pytest .mark .skipif (not  IS_LINUX ) 
923+ @pytest .mark .skipif (not  IS_LINUX ,  reason = HEIC_AVIF_MESSAGE ) 
924924# @pytest.mark.parametrize("decode_fun", (decode_avif, decode_image)) 
925925@pytest .mark .parametrize ("decode_fun" , (decode_avif ,)) 
926926def  test_decode_avif (decode_fun ):
@@ -933,7 +933,7 @@ def test_decode_avif(decode_fun):
933933
934934# Note: decode_image fails because some of these files have a (valid) signature 
935935# we don't recognize. We should probably use libmagic.... 
936- @pytest .mark .skipif (not  IS_LINUX ) 
936+ @pytest .mark .skipif (not  IS_LINUX ,  reason = HEIC_AVIF_MESSAGE ) 
937937@pytest .mark .parametrize ("decode_fun" , (decode_avif , decode_heic )) 
938938@pytest .mark .parametrize ( 
939939    "mode, pil_mode" , 
@@ -1011,7 +1011,7 @@ def test_decode_avif_heic_against_pil(decode_fun, mode, pil_mode, filename):
10111011
10121012# TODO_AVIF_HEIC make decode_image work 
10131013# @pytest.mark.parametrize("decode_fun", (decode_heic, decode_image)) 
1014- @pytest .mark .skipif (not  IS_LINUX ) 
1014+ @pytest .mark .skipif (not  IS_LINUX ,  reason = HEIC_AVIF_MESSAGE ) 
10151015@pytest .mark .parametrize ("decode_fun" , (decode_heic ,)) 
10161016def  test_decode_heic (decode_fun ):
10171017    encoded_bytes  =  read_file (next (get_images (FAKEDATA_DIR , ".heic" )))
0 commit comments