diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 4cd4515ae..289c09767 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -571,8 +571,8 @@ class TestFilePng: assert len(chunks) == 3 def test_read_private_chunks(self): - im = Image.open("Tests/images/exif.png") - assert im.private_chunks == [(b"orNT", b"\x01")] + with Image.open("Tests/images/exif.png") as im: + assert im.private_chunks == [(b"orNT", b"\x01")] def test_roundtrip_private_chunk(self): # Check private chunk roundtripping