Skip to content

Commit 2810ded

Browse files
committed
Disable hash comparison on Windows and macOS
1 parent d2c962d commit 2810ded

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

tests/test_plot.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# stdlib
22
import os
3+
import platform
34
import sys
45
from typing import List
56

@@ -24,22 +25,28 @@
2425
baseline_dir = str(PathPlus(__file__).parent / "baseline")
2526
assert os.path.exists(baseline_dir)
2627

27-
if sys.version_info[:2] == (3, 7):
28-
image_hashes = str(PathPlus(__file__).parent / "image_hashes_37.json")
29-
elif sys.version_info[:2] == (3, 8):
30-
image_hashes = str(PathPlus(__file__).parent / "image_hashes_38.json")
31-
elif sys.version_info[:2] == (3, 9):
32-
image_hashes = str(PathPlus(__file__).parent / "image_hashes_39.json")
28+
if platform.system == "Linux":
29+
if sys.version_info[:2] == (3, 7):
30+
image_hashes = str(PathPlus(__file__).parent / "image_hashes_37.json")
31+
elif sys.version_info[:2] == (3, 8):
32+
image_hashes = str(PathPlus(__file__).parent / "image_hashes_38.json")
33+
elif sys.version_info[:2] == (3, 9):
34+
image_hashes = str(PathPlus(__file__).parent / "image_hashes_39.json")
35+
else:
36+
image_hashes = str(PathPlus(__file__).parent / "image_hashes.json")
37+
38+
check_images = pytest.mark.mpl_image_compare(
39+
baseline_dir=baseline_dir,
40+
savefig_kwargs={"dpi": 600},
41+
hash_library=image_hashes,
42+
style="default",
43+
)
3344
else:
34-
image_hashes = str(PathPlus(__file__).parent / "image_hashes.json")
35-
36-
check_images = pytest.mark.mpl_image_compare(
37-
baseline_dir=baseline_dir,
38-
savefig_kwargs={"dpi": 600},
39-
hash_library=image_hashes,
40-
style="default",
41-
)
42-
45+
check_images = pytest.mark.mpl_image_compare(
46+
baseline_dir=baseline_dir,
47+
savefig_kwargs={"dpi": 600},
48+
style="default",
49+
)
4350

4451
@check_images
4552
def test_plot_ic(im_i: IntensityMatrix):

0 commit comments

Comments
 (0)