@@ -329,21 +329,22 @@ def test_hash_fail_hybrid(tmpdir):
329
329
f .write (TEST_FAILING_HYBRID )
330
330
331
331
# Assert that image comparison runs and fails
332
+ expected = "does not match baseline hash 'FAIL' in library"
332
333
output = assert_pytest_fails_with (['--mpl' , test_file ,
333
334
rf'--mpl-baseline-path={ hash_baseline_dir_abs / "fail" } ' ],
334
- "doesn't match hash FAIL in library" )
335
+ expected )
335
336
assert "Error: Image files did not match." in output , output
336
337
337
338
# Assert reports missing baseline image
338
339
output = assert_pytest_fails_with (['--mpl' , test_file ,
339
340
'--mpl-baseline-path=/not/a/path' ],
340
- "doesn't match hash FAIL in library" )
341
+ expected )
341
342
assert "Image file not found for comparison test" in output , output
342
343
343
344
# Assert reports image comparison succeeds
344
345
output = assert_pytest_fails_with (['--mpl' , test_file ,
345
346
rf'--mpl-baseline-path={ hash_baseline_dir_abs / "succeed" } ' ],
346
- "doesn't match hash FAIL in library" )
347
+ expected )
347
348
assert "The comparison to the baseline image succeeded." in output , output
348
349
349
350
# If we don't use --mpl option, the test should succeed
@@ -371,16 +372,17 @@ def test_hash_fail_new_hashes(tmpdir):
371
372
f .write (TEST_FAILING_NEW_HASH )
372
373
373
374
# Assert that image comparison runs and fails
375
+ expected = "does not match baseline hash 'FAIL' in library"
374
376
assert_pytest_fails_with (['--mpl' , test_file ,
375
377
f'--mpl-hash-library={ fail_hash_library } ' ],
376
- "doesn't match hash FAIL in library" )
378
+ expected )
377
379
378
380
hash_file = tmpdir .join ('new_hashes.json' ).strpath
379
381
# Assert that image comparison runs and fails
380
382
assert_pytest_fails_with (['--mpl' , test_file ,
381
383
f'--mpl-hash-library={ fail_hash_library } ' ,
382
384
f'--mpl-generate-hash-library={ hash_file } ' ],
383
- "doesn't match hash FAIL" )
385
+ expected )
384
386
385
387
386
388
TEST_MISSING_HASH = """
0 commit comments