@@ -499,8 +499,8 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
499
499
hash_comparison_pass = True
500
500
else :
501
501
error_message = (f"Hash { test_hash } doesn't match hash "
502
- f"{ hash_library [hash_name ]} in library "
503
- f"{ hash_library_filename } for test { hash_name } ." )
502
+ f"{ hash_library [hash_name ]} in library "
503
+ f"{ hash_library_filename } for test { hash_name } ." )
504
504
505
505
# If the compare has only been specified with hash and not baseline
506
506
# dir, don't attempt to find a baseline image at the default path.
@@ -512,24 +512,20 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
512
512
# Ignore Errors here as it's possible the reference image dosen't exist yet.
513
513
try :
514
514
baseline_image_path = self .obtain_baseline_image (item , result_dir )
515
+ baseline_image = baseline_image_path
516
+ baseline_image = None if (baseline_image and not baseline_image .exists ()) else baseline_image
515
517
# Get the baseline and generate a diff image, always so that
516
518
# --mpl-results-always can be respected.
517
519
baseline_comparison = self .compare_image_to_baseline (item , fig , result_dir )
518
- except Exception as e :
519
- warnings .warn (str (e ))
520
-
521
- try :
522
- baseline_image = baseline_image_path
523
- baseline_image = None if (baseline_image and not baseline_image .exists ()) else baseline_image
524
- except Exception :
525
- baseline_image = None
520
+ except Exception as baseline_error :
521
+ baseline_image = None
526
522
527
523
# If the hash comparison passes then return
528
524
if hash_comparison_pass :
529
525
return
530
526
531
527
if baseline_image is None :
532
- error_message += f"\n Unable to find baseline image { baseline_image_path or '' } . "
528
+ error_message += f"\n Unable to find baseline image for { item } . \n { baseline_error } "
533
529
return error_message
534
530
535
531
# Override the tolerance (if not explicitly set) to 0 as the hashes are not forgiving
0 commit comments