|
32 | 32 | fail_hash_library = Path(__file__).parent / "baseline" / "test_hash_lib.json" |
33 | 33 | baseline_dir_abs = Path(__file__).parent / "baseline" / baseline_subdir |
34 | 34 | hash_baseline_dir_abs = Path(__file__).parent / "baseline" / "hybrid" |
| 35 | +phash_library = Path(__file__).parent / "baseline" / "hashes" / "test_phash.json" |
35 | 36 |
|
36 | 37 |
|
37 | 38 | WIN = sys.platform.startswith('win') |
@@ -491,31 +492,14 @@ def test_results_always(tmpdir): |
491 | 492 | assert json_res[json_image_key] is None |
492 | 493 |
|
493 | 494 |
|
494 | | -def test_phash(tmpdir, capsys): |
| 495 | +def test_phash(tmpdir): |
495 | 496 | test_file = tmpdir.join("test.py").strpath |
496 | 497 | with open(test_file, "w") as fo: |
497 | 498 | fo.write(TEST_GENERATE) |
498 | 499 |
|
499 | | - results_dir = tmpdir.mkdir("foo").strpath |
500 | | - gen_dir = tmpdir.mkdir("bar").strpath |
501 | | - hash_file = "test_phash.json" |
502 | | - |
503 | | - code = call_pytest([f"--mpl-generate-path={gen_dir}", test_file]) |
504 | | - assert code == 0 |
505 | | - assert os.path.exists(os.path.join(gen_dir, "test_gen.png")) |
506 | | - |
507 | | - command = [f"--mpl-generate-hash-library={hash_file}", |
508 | | - "--mpl-results-always", |
509 | | - f"--mpl-results-path={results_dir}", |
| 500 | + command = ["--mpl", |
510 | 501 | "--mpl-kernel=phash", |
| 502 | + f"--mpl-hash-library={phash_library}", |
511 | 503 | test_file] |
512 | 504 | code = call_pytest(command) |
513 | | - hash_file = os.path.join(results_dir, hash_file) |
514 | | - assert os.path.exists(os.path.join(hash_file)) |
515 | | - |
516 | | - with open(hash_file) as fi: |
517 | | - hash_lib = json.load(fi) |
518 | | - |
519 | | - with capsys.disabled(): |
520 | | - from pprint import pprint |
521 | | - pprint(hash_lib) |
| 505 | + assert code == 0 |
0 commit comments