Skip to content

Commit

Permalink
TST: Cleanup temporary files (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubpub-zz committed Nov 25, 2022
1 parent b6bfc17 commit 940819f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions tests/test_reader.py
Expand Up @@ -203,12 +203,19 @@ def test_get_images(src, expected_images):
assert len(images_extracted) == len(expected_images)
for image, expected_image in zip(images_extracted, expected_images):
assert image.name == expected_image
with open(f"test-out-{src}-{image.name}", "wb") as fp:
fp.write(image.data)
assert (
image.name.split(".")[-1].upper()
== Image.open(io.BytesIO(image.data)).format
)
try:
fn = f"test-out-{src}-{image.name}"
with open(fn, "wb") as fp:
fp.write(image.data)
assert (
image.name.split(".")[-1].upper()
== Image.open(io.BytesIO(image.data)).format
)
finally:
try:
os.remove(fn)
except Exception:
pass


@pytest.mark.parametrize(
Expand Down

0 comments on commit 940819f

Please sign in to comment.