Skip to content

Commit cd72400

Browse files
committed
Don't error if we can't get a baseline while comparing hashes
1 parent 7bb5d44 commit cd72400

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytest_mpl/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,15 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
488488
fig.savefig(str(test_image), **savefig_kwargs)
489489
return error_message
490490

491-
baseline_image_path = self.obtain_baseline_image(item, result_dir)
492491
try:
492+
baseline_image_path = self.obtain_baseline_image(item, result_dir)
493493
baseline_image = baseline_image_path
494494
baseline_image = None if not baseline_image.exists() else baseline_image
495495
except Exception:
496496
baseline_image = None
497497

498498
if baseline_image is None:
499-
error_message += f"\nUnable to find baseline image {baseline_image_path}."
499+
error_message += f"\nUnable to find baseline image for {item}."
500500
return error_message
501501

502502
# Override the tolerance (if not explicitly set) to 0 as the hashes are not forgiving

0 commit comments

Comments
 (0)