Skip to content

Commit 0f31fd9

Browse files
authored
CI: Avoid flaky hypothesis test with deadline=None (pandas-dev#44969)
* CI: Avoid flaky hypothesis test with deadline=None * Add issue ref * Move set up to _hypothesis.py
1 parent f985e58 commit 0f31fd9

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

pandas/_testing/_hypothesis.py

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
min_size=3,
4545
)
4646

47+
OPTIONAL_ONE_OF_ALL = st.one_of(
48+
OPTIONAL_DICTS, OPTIONAL_FLOATS, OPTIONAL_INTS, OPTIONAL_LISTS, OPTIONAL_TEXT
49+
)
50+
4751
if is_platform_windows():
4852
DATETIME_NO_TZ = st.datetimes(min_value=datetime(1900, 1, 1))
4953
else:

pandas/tests/frame/indexing/test_where.py

+4-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from hypothesis import (
44
given,
5-
strategies as st,
5+
settings,
66
)
77
import numpy as np
88
import pytest
@@ -22,13 +22,7 @@
2222
isna,
2323
)
2424
import pandas._testing as tm
25-
from pandas._testing._hypothesis import (
26-
OPTIONAL_DICTS,
27-
OPTIONAL_FLOATS,
28-
OPTIONAL_INTS,
29-
OPTIONAL_LISTS,
30-
OPTIONAL_TEXT,
31-
)
25+
from pandas._testing._hypothesis import OPTIONAL_ONE_OF_ALL
3226

3327

3428
@pytest.fixture(params=["default", "float_string", "mixed_float", "mixed_int"])
@@ -874,11 +868,8 @@ def test_where_nullable_invalid_na(frame_or_series, any_numeric_ea_dtype):
874868
obj.mask(mask, null)
875869

876870

877-
@given(
878-
data=st.one_of(
879-
OPTIONAL_DICTS, OPTIONAL_FLOATS, OPTIONAL_INTS, OPTIONAL_LISTS, OPTIONAL_TEXT
880-
)
881-
)
871+
@given(data=OPTIONAL_ONE_OF_ALL)
872+
@settings(deadline=None) # GH 44969
882873
def test_where_inplace_casting(data):
883874
# GH 22051
884875
df = DataFrame({"a": data})

0 commit comments

Comments
 (0)