From 55fa5149e25f6f2e01bf4b2a2a625b5c00011394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 5 Oct 2023 10:54:43 +0200 Subject: [PATCH] Always save the result image, better assertion on different image size --- c2cwsgiutils/acceptance/image.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/c2cwsgiutils/acceptance/image.py b/c2cwsgiutils/acceptance/image.py index f5a53b7e1..233cdbb95 100644 --- a/c2cwsgiutils/acceptance/image.py +++ b/c2cwsgiutils/acceptance/image.py @@ -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) @@ -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 )