@@ -329,21 +329,22 @@ def test_hash_fail_hybrid(tmpdir):
329329 f .write (TEST_FAILING_HYBRID )
330330
331331 # Assert that image comparison runs and fails
332+ expected = "does not match baseline hash 'FAIL' in library"
332333 output = assert_pytest_fails_with (['--mpl' , test_file ,
333334 rf'--mpl-baseline-path={ hash_baseline_dir_abs / "fail" } ' ],
334- "doesn't match hash FAIL in library" )
335+ expected )
335336 assert "Error: Image files did not match." in output , output
336337
337338 # Assert reports missing baseline image
338339 output = assert_pytest_fails_with (['--mpl' , test_file ,
339340 '--mpl-baseline-path=/not/a/path' ],
340- "doesn't match hash FAIL in library" )
341+ expected )
341342 assert "Image file not found for comparison test" in output , output
342343
343344 # Assert reports image comparison succeeds
344345 output = assert_pytest_fails_with (['--mpl' , test_file ,
345346 rf'--mpl-baseline-path={ hash_baseline_dir_abs / "succeed" } ' ],
346- "doesn't match hash FAIL in library" )
347+ expected )
347348 assert "The comparison to the baseline image succeeded." in output , output
348349
349350 # If we don't use --mpl option, the test should succeed
@@ -371,16 +372,17 @@ def test_hash_fail_new_hashes(tmpdir):
371372 f .write (TEST_FAILING_NEW_HASH )
372373
373374 # Assert that image comparison runs and fails
375+ expected = "does not match baseline hash 'FAIL' in library"
374376 assert_pytest_fails_with (['--mpl' , test_file ,
375377 f'--mpl-hash-library={ fail_hash_library } ' ],
376- "doesn't match hash FAIL in library" )
378+ expected )
377379
378380 hash_file = tmpdir .join ('new_hashes.json' ).strpath
379381 # Assert that image comparison runs and fails
380382 assert_pytest_fails_with (['--mpl' , test_file ,
381383 f'--mpl-hash-library={ fail_hash_library } ' ,
382384 f'--mpl-generate-hash-library={ hash_file } ' ],
383- "doesn't match hash FAIL" )
385+ expected )
384386
385387
386388TEST_MISSING_HASH = """
0 commit comments