From b4b296ff1239274230b290355fca262efb068452 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Mon, 28 Oct 2024 17:07:47 -0500 Subject: [PATCH] Fix dir issues in comparing images --- tests/integration/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/integration/utils.py b/tests/integration/utils.py index f33a0815..468ffd4f 100644 --- a/tests/integration/utils.py +++ b/tests/integration/utils.py @@ -62,13 +62,17 @@ def compare_images( mismatched_images.append(image_name) + actual_dir = os.path.join(diff_dir, "{}_actual.png".format(image_name)) + os.makedirs(os.path.dirname(actual_dir), exist_ok=True) shutil.copy( path_to_actual_png, - os.path.join(diff_dir, "{}_actual.png".format(image_name)), + actual_dir, ) + expected_dir = os.path.join(diff_dir, "{}_expected.png".format(image_name)) + os.makedirs(os.path.dirname(expected_dir), exist_ok=True) shutil.copy( path_to_expected_png, - os.path.join(diff_dir, "{}_expected.png".format(image_name)), + expected_dir, ) # https://stackoverflow.com/questions/41405632/draw-a-rectangle-and-a-text-in-it-using-pil draw = ImageDraw.Draw(diff)