From 7020dad44e7610f8f64cd86fc1c4ef5b326f2474 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 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/integration/utils.py b/tests/integration/utils.py index f33a0815..9ed0bcb3 100644 --- a/tests/integration/utils.py +++ b/tests/integration/utils.py @@ -62,13 +62,21 @@ def compare_images( mismatched_images.append(image_name) + diff_dir_actual_png = os.path.join( + diff_dir, "{}_actual.png".format(image_name) + ) + os.makedirs(os.path.dirname(diff_dir_actual_png), exist_ok=True) shutil.copy( path_to_actual_png, - os.path.join(diff_dir, "{}_actual.png".format(image_name)), + diff_dir_actual_png, + ) + diff_dir_expected_png = os.path.join( + diff_dir, "{}_expected.png".format(image_name) ) + os.makedirs(os.path.dirname(diff_dir_expected_png), exist_ok=True) shutil.copy( path_to_expected_png, - os.path.join(diff_dir, "{}_expected.png".format(image_name)), + diff_dir_expected_png, ) # https://stackoverflow.com/questions/41405632/draw-a-rectangle-and-a-text-in-it-using-pil draw = ImageDraw.Draw(diff)