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):