From 12bbac0308295e147093aec2cd124193fa04411d Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Thu, 1 Nov 2018 17:02:13 +1100 Subject: [PATCH 1/2] Adjust Hypothesis timeout settings Again. --- pandas/conftest.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 6142f188f5613..03e09175bdb09 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -14,10 +14,12 @@ hypothesis.settings.register_profile( "ci", # Hypothesis timing checks are tuned for scalars by default, so we bump - # them from 200ms to 5 secs per test case as the global default. If this + # them from 200ms to 500ms per test case as the global default. If this # is too short for a specific test, (a) try to make it faster, and (b) - # if it really is slow add `@settings(timeout=...)` with a working value. - timeout=5000, + # if it really is slow add `@settings(deadline=...)` with a working value, + # or `deadline=None` to entirely disable timeouts for that test. + deadline=500, + timeout=hypothesis.unlimited, suppress_health_check=(hypothesis.HealthCheck.too_slow,) ) hypothesis.settings.load_profile("ci") From bf05e077a427c34a83c3d233e69f0e1c565df937 Mon Sep 17 00:00:00 2001 From: Zac Hatfield-Dodds Date: Thu, 1 Nov 2018 17:02:34 +1100 Subject: [PATCH 2/2] Define strategy as function, not method --- pandas/tests/frame/test_apply.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/pandas/tests/frame/test_apply.py b/pandas/tests/frame/test_apply.py index ca3469f34fee6..c43872bfc3ddb 100644 --- a/pandas/tests/frame/test_apply.py +++ b/pandas/tests/frame/test_apply.py @@ -823,6 +823,20 @@ def zip_frames(frames, axis=1): return pd.DataFrame(zipped) +@composite +def indices(draw, max_length=5): + date = draw( + dates( + min_value=Timestamp.min.ceil("D").to_pydatetime().date(), + max_value=Timestamp.max.floor("D").to_pydatetime().date(), + ).map(Timestamp) + ) + periods = draw(integers(0, max_length)) + freq = draw(sampled_from(list("BDHTS"))) + dr = date_range(date, periods=periods, freq=freq) + return pd.DatetimeIndex(list(dr)) + + class TestDataFrameAggregate(): def test_agg_transform(self, axis, float_frame): @@ -1142,20 +1156,7 @@ def test_agg_cython_table_raises(self, df, func, expected, axis): with pytest.raises(expected): df.agg(func, axis=axis) - @composite - def indices(draw, max_length=5): - date = draw( - dates( - min_value=Timestamp.min.ceil("D").to_pydatetime().date(), - max_value=Timestamp.max.floor("D").to_pydatetime().date(), - ).map(Timestamp) - ) - periods = draw(integers(0, max_length)) - freq = draw(sampled_from(list("BDHTS"))) - dr = date_range(date, periods=periods, freq=freq) - return pd.DatetimeIndex(list(dr)) - - @given(index=indices(5), num_columns=integers(0, 5)) + @given(index=indices(max_length=5), num_columns=integers(0, 5)) def test_frequency_is_original(self, index, num_columns): # GH 22150 original = index.copy()