Skip to content

Commit

Permalink
Always save the result image, better assertion on different image size
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Oct 5, 2023
1 parent a5fe484 commit 55fa514
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion c2cwsgiutils/acceptance/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def check_image(
if generate_expected_image:
skimage.io.imsave(expected_filename, image_to_check)
return
skimage.io.imsave(result_filename, image_to_check)
if not os.path.isfile(expected_filename):
skimage.io.imsave(result_filename, image_to_check)
skimage.io.imsave(expected_filename, image_to_check)
assert False, "Expected image not found: " + expected_filename
expected = skimage.io.imread(expected_filename)
Expand All @@ -137,6 +137,9 @@ def check_image(
if mask is not None:
expected[mask] = [255, 255, 255]

assert (
expected.shape == image_to_check.shape
), f"Images have different shapes expected {expected.shape} != actual {image_to_check.shape}"
score, diff = skimage.metrics.structural_similarity(
expected, image_to_check, multichannel=True, full=True, channel_axis=2
)
Expand Down

0 comments on commit 55fa514

Please sign in to comment.