Skip to content

Commit

Permalink
Fix dir issues in comparing images
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 committed Oct 28, 2024
1 parent f759fdc commit 6e4e30f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,23 @@ def compare_images(

mismatched_images.append(image_name)

diff_dir_actual_png = os.path.join(
diff_dir, "{}_actual.png".format(image_name)
)
# image_name could contain a number of subdirectories.
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)
)
# image_name could contain a number of subdirectories.
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)
Expand Down

0 comments on commit 6e4e30f

Please sign in to comment.