From 79d1068ca63407c2b8a8cdf3ba3db7b111b2cb98 Mon Sep 17 00:00:00 2001 From: kratel Date: Thu, 13 May 2021 23:41:33 -0400 Subject: [PATCH] Update test to check for filename in exception info. --- Tests/test_imagefile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tests/test_imagefile.py b/Tests/test_imagefile.py index b4107e8e3..13d1f85d8 100644 --- a/Tests/test_imagefile.py +++ b/Tests/test_imagefile.py @@ -120,12 +120,14 @@ class TestImageFile: @skip_unless_feature("zlib") def test_truncated_with_errors(self): with Image.open("Tests/images/truncated_image.png") as im: - with pytest.raises(OSError): + with pytest.raises(OSError) as oseinfo: im.load() + assert "Tests/images/truncated_image.png" in str(oseinfo.value) # Test that the error is raised if loaded a second time - with pytest.raises(OSError): + with pytest.raises(OSError) as oseinfo: im.load() + assert "Tests/images/truncated_image.png" in str(oseinfo.value) @skip_unless_feature("zlib") def test_truncated_without_errors(self):