Skip to content

Commit

Permalink
Fix dir issues in comparing images (E3SM-Project#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
forsyth2 authored and zhangshixuan1987 committed Nov 1, 2024
1 parent 233a294 commit e2dc984
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 e2dc984

Please sign in to comment.