Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tests/test_default_tolerance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
@pytest.fixture(scope="module")
def baseline_image(tmp_path_factory):
path = Path(__file__).parent / "baseline" / "2.0.x" / f"{TEST_NAME}.png"
image = Image.open(path)
draw = ImageDraw.Draw(image)
draw.rectangle(((0, 0), (100, 100)), fill="red")
output = tmp_path_factory.mktemp("data") / f"{TEST_NAME}.png"
image.save(output)
with Image.open(path) as image:
draw = ImageDraw.Draw(image)
draw.rectangle(((0, 0), (100, 100)), fill="red")
output = tmp_path_factory.mktemp("data") / f"{TEST_NAME}.png"
image.save(output)
return output


Expand Down
3 changes: 2 additions & 1 deletion tests/test_deterministic.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def test_mpl():
assert key_in_file

else: # "eps" or "png"
actual_metadata = Image.open(str(baseline_image)).info
with Image.open(str(baseline_image)) as image:
actual_metadata = image.info
for k, expected in deterministic_metadata.items():
actual = actual_metadata.get(k, None)
if success_expected: # metadata keys should not be in the file
Expand Down