Skip to content

Commit c0f2adf

Browse files
committed
clean up test config, add special tolerace from GH Actions
1 parent 8ebe1e5 commit c0f2adf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

probscale/tests/test_probscale.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
import numpy
@@ -14,7 +15,9 @@
1415
from probscale.probscale import _minimal_norm
1516

1617

17-
TOLERANCE = 15
18+
# special toloerance for Github Action CI
19+
TOLERANCE = int(os.environ.get("MPL_IMGCOMP_TOLERANCE", 15))
20+
BASELINE_DIR = "baseline_images/test_probscale"
1821

1922

2023
@pytest.fixture
@@ -132,7 +135,7 @@ def test_sign_with_nan_no_warning(mn):
132135

133136

134137
@pytest.mark.mpl_image_compare(
135-
baseline_dir="baseline_images/test_probscale", tolerance=TOLERANCE, remove_text=True
138+
baseline_dir=BASELINE_DIR, tolerance=TOLERANCE, remove_text=True
136139
)
137140
def test_the_scale_default():
138141
fig, ax = plt.subplots(figsize=(4, 8))
@@ -142,9 +145,7 @@ def test_the_scale_default():
142145
return fig
143146

144147

145-
@pytest.mark.mpl_image_compare(
146-
baseline_dir="baseline_images/test_probscale", tolerance=TOLERANCE
147-
)
148+
@pytest.mark.mpl_image_compare(baseline_dir=BASELINE_DIR, tolerance=TOLERANCE)
148149
def test_the_scale_not_as_pct():
149150
fig, ax = plt.subplots(figsize=(4, 8))
150151
ax.set_yscale("prob", as_pct=False)
@@ -153,7 +154,7 @@ def test_the_scale_not_as_pct():
153154

154155

155156
@pytest.mark.mpl_image_compare(
156-
baseline_dir="baseline_images/test_probscale", tolerance=TOLERANCE, remove_text=True
157+
baseline_dir=BASELINE_DIR, tolerance=TOLERANCE, remove_text=True
157158
)
158159
@pytest.mark.skipif(stats is None, reason="scipy not installed")
159160
def test_the_scale_beta():

0 commit comments

Comments
 (0)