Skip to content

Commit 63afd42

Browse files
authored
Merge pull request #118 from Cadair/dont_error_if_missing_baseline
Don't error if we can't get a baseline while comparing hashes
2 parents 7bb5d44 + a0f287e commit 63afd42

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
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

tests/baseline/hashes/mpl33_ft261.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
"test_pytest_mpl.test_parametrized[5]": "04c998af2d7932ca4a851d610e8a020d94a2f623d1301dbe9b59fe6efd28a5f7",
1010
"test_pytest_mpl.test_parametrized[50]": "937d986ab6b209e7d48eb30cc30e9db62c93bbc4c86768e276a5b454e63bca93",
1111
"test_pytest_mpl.test_parametrized[500]": "e39ed724b0762b8736879801e32dc0c1525afd03c0567a43b119435aaa608498",
12-
"test_pytest_mpl.test_hash_succeeds": "4150d2d146801b5feb41ef6bd022d5baabf4811c7f2e9ed72b639e80904243e1"
12+
"test_pytest_mpl.test_hash_succeeds": "55ad74a44c99606f1df1e79f67a59a4986bddc2b48ea2b2d7ea8365db91dc7ca"
1313
}

0 commit comments

Comments
 (0)