From cd9f37e813fb2d7dec0942ebfdd666b142879597 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 1 Nov 2019 11:52:48 +0200 Subject: [PATCH] Ignore UserWarning for 4 tags: 'Possibly corrupt EXIF data. Expecting to read X bytes but only got Y. Skipping tag Z' --- Tests/test_file_tiff.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index a335e5e7a..683fa5446 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -1,5 +1,6 @@ import logging import os +import warnings from io import BytesIO from PIL import Image, TiffImagePlugin @@ -578,7 +579,11 @@ class TestFileTiff(PillowTestCase): def test_string_dimension(self): # Assert that an error is raised if one of the dimensions is a string with self.assertRaises(ValueError): - Image.open("Tests/images/string_dimension.tiff") + # Ignore this UserWarning which triggers for four tags: + # "Possibly corrupt EXIF data. Expecting to read 50404352 bytes but..." + with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=UserWarning) + Image.open("Tests/images/string_dimension.tiff") @unittest.skipUnless(is_win32(), "Windows only")