From 09956b62190f701fbea0826977ef7de27c39c19f Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Sat, 6 Mar 2021 15:36:49 +0000 Subject: [PATCH] Improved resilience of compare_images. --- scripts/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/tests.py b/scripts/tests.py index 1e52a34..4b6b1d3 100755 --- a/scripts/tests.py +++ b/scripts/tests.py @@ -60,7 +60,8 @@ def compare_images(a, b, c): with open(log_name, 'w') as output: do_cmd(("magick compare -metric AE -fuzz %d%% %s %s %s" % (fuzz, a, b, c)).split(), output = output) with open(log_name, 'r') as f: - pixels = int(float(f.read().strip())) + pixels = f.read().strip() + pixels = int(float(pixels if pixels.isnumeric() else -1)) os.remove(log_name) return pixels