Skip to content

Commit

Permalink
Merge pull request #2005 from camptocamp/backport/2004-to-master
Browse files Browse the repository at this point in the history
[Backport master] Always save the result image, better assertion on different image size
  • Loading branch information
sbrunner authored Oct 5, 2023
2 parents b15df88 + 812227f commit f3314f2
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 f3314f2

Please sign in to comment.