Skip to content

Commit 8f51fba

Browse files
test(approvaltests reporter): create png if not exists
1 parent 9b63117 commit 8f51fba

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/approvaltests_reporters.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from approvaltests.reporters.report_with_diff_command_line import (
1717
ReportWithDiffCommandLine,
1818
)
19+
from PIL import Image
1920

2021

2122
class BlockingGenericDiffReporter(GenericDiffReporter):
@@ -172,6 +173,9 @@ def report(self, received_path: str, approved_path: str) -> bool:
172173
raw = json.load(file)
173174
approved_figure = pgo.Figure(raw)
174175
approved_figure.write_image(approved_path_image)
176+
else:
177+
image = Image.new("RGB", (1, 1))
178+
image.save(approved_path_image, "PNG")
175179

176180
with open(received_path, "r") as file:
177181
raw = json.load(file)

0 commit comments

Comments
 (0)