Skip to content

Commit 9be6e3c

Browse files
committed
silence hypothesis health check warnings
1 parent 1532ec8 commit 9be6e3c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

xarray_array_testing/creation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import hypothesis.strategies as st
22
import xarray.testing.strategies as xrst
3-
from hypothesis import given
3+
from hypothesis import given, settings, HealthCheck
44

55
from xarray_array_testing.base import DuckArrayTestMixin
66

77

88
class CreationTests(DuckArrayTestMixin):
9+
@settings(suppress_health_check=[HealthCheck.differing_executors])
910
@given(st.data())
1011
def test_create_variable(self, data):
1112
variable = data.draw(xrst.variables(array_strategy_fn=self.array_strategy_fn))

xarray_array_testing/reduction.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import hypothesis.strategies as st
44
import xarray.testing.strategies as xrst
5-
from hypothesis import given
5+
from hypothesis import given, settings, HealthCheck, note
66

77
from xarray_array_testing.base import DuckArrayTestMixin
88

@@ -12,16 +12,22 @@ class ReductionTests(DuckArrayTestMixin):
1212
def expected_errors(op, **parameters):
1313
return nullcontext()
1414

15+
# TODO understand the differing executors health check error
16+
@settings(suppress_health_check=[HealthCheck.differing_executors])
1517
@given(st.data())
1618
def test_variable_mean(self, data):
1719
variable = data.draw(xrst.variables(array_strategy_fn=self.array_strategy_fn))
1820

21+
note(f"note: {variable}")
22+
1923
with self.expected_errors("mean", variable=variable):
2024
actual = variable.mean().data
2125
expected = self.xp.mean(variable.data)
2226

23-
self.assert_equal(actual, expected)
27+
assert isinstance(actual, self.array_type), type(actual)
28+
self.assert_equal(actual, expected)
2429

30+
@settings(suppress_health_check=[HealthCheck.differing_executors])
2531
@given(st.data())
2632
def test_variable_prod(self, data):
2733
variable = data.draw(xrst.variables(array_strategy_fn=self.array_strategy_fn))
@@ -30,4 +36,5 @@ def test_variable_prod(self, data):
3036
actual = variable.prod().data
3137
expected = self.xp.prod(variable.data)
3238

33-
self.assert_equal(actual, expected)
39+
assert isinstance(actual, self.array_type), type(actual)
40+
self.assert_equal(actual, expected)

0 commit comments

Comments
 (0)