Removed "del im"

This commit is contained in:
Andrew Murray 2023-03-03 07:50:52 +11:00 committed by Aarni Koskela
parent 1263018d2a
commit 9ed8ca1494
8 changed files with 32 additions and 16 deletions

View File

@ -24,10 +24,12 @@ def test_sanity():
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(TEST_FILE)
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -32,10 +32,12 @@ def test_sanity():
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(static_test_file)
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -32,10 +32,12 @@ def test_sanity():
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(TEST_GIF)
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -28,10 +28,12 @@ def test_name_limit(tmp_path):
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(TEST_IM)
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -38,10 +38,12 @@ def test_sanity(test_file):
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(test_files[0])
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -23,10 +23,12 @@ def test_sanity():
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(test_file)
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -21,10 +21,12 @@ def test_sanity():
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file():
with pytest.warns(ResourceWarning):
def open():
im = Image.open(TEST_FILE)
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file():

View File

@ -57,10 +57,12 @@ class TestFileTiff:
@pytest.mark.skipif(is_pypy(), reason="Requires CPython")
def test_unclosed_file(self):
with pytest.warns(ResourceWarning):
def open():
im = Image.open("Tests/images/multipage.tiff")
im.load()
del im
with pytest.warns(ResourceWarning):
open()
def test_closed_file(self):
with warnings.catch_warnings():