Skip to content

Commit 5ddddc8

Browse files
committed
Undefined variable
1 parent c3ba918 commit 5ddddc8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pytest_mpl/plugin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
509509

510510
# If this is not a new test try and get the baseline image.
511511
if not new_test:
512+
baseline_error = None
512513
# Ignore Errors here as it's possible the reference image dosen't exist yet.
513514
try:
514515
baseline_image_path = self.obtain_baseline_image(item, result_dir)
@@ -525,7 +526,9 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
525526
return
526527

527528
if baseline_image is None:
528-
error_message += f"\nUnable to find baseline image for {item}.\n{baseline_error}"
529+
error_message += f"\nUnable to find baseline image for {item}."
530+
if baseline_error:
531+
error_message += f"\n{baseline_error}"
529532
return error_message
530533

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

0 commit comments

Comments
 (0)