@@ -181,8 +181,8 @@ def pytest_configure(config):
181
181
results_dir = config .getoption ("--mpl-results-path" ) or config .getini ("mpl-results-path" )
182
182
hash_library = config .getoption ("--mpl-hash-library" )
183
183
generate_summary = config .getoption ("--mpl-generate-summary" )
184
- results_always = config .getoption ("--mpl-results-always" ) or config . getini ( "mpl-results-always" )
185
-
184
+ results_always = ( config .getoption ("--mpl-results-always" ) or
185
+ config . getini ( "mpl-results-always" ))
186
186
187
187
if config .getoption ("--mpl-baseline-relative" ):
188
188
baseline_relative_dir = config .getoption ("--mpl-baseline-path" )
@@ -489,7 +489,6 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
489
489
error_message = (f"Hash for test '{ hash_name } ' not found in { hash_library_filename } . "
490
490
f"Generated hash is { test_hash } ." )
491
491
492
-
493
492
# Save the figure for later summary (will be removed later if not needed)
494
493
test_image = (result_dir / "result.png" ).absolute ()
495
494
fig .savefig (str (test_image ), ** savefig_kwargs )
@@ -514,12 +513,14 @@ def compare_image_to_hash_library(self, item, fig, result_dir):
514
513
try :
515
514
baseline_image_path = self .obtain_baseline_image (item , result_dir )
516
515
baseline_image = baseline_image_path
517
- baseline_image = None if (baseline_image and not baseline_image .exists ()) else baseline_image
516
+ if baseline_image and not baseline_image .exists ():
517
+ baseline_image = None
518
518
# Get the baseline and generate a diff image, always so that
519
519
# --mpl-results-always can be respected.
520
520
baseline_comparison = self .compare_image_to_baseline (item , fig , result_dir )
521
- except Exception as baseline_error :
521
+ except Exception as e :
522
522
baseline_image = None
523
+ baseline_error = e
523
524
524
525
# If the hash comparison passes then return
525
526
if hash_comparison_pass :
0 commit comments