Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unclosed test files #222

Merged
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.
Jump to
Jump to file
Failed to load files.
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