From 071dc176be840e77981d761dc556c1b1e15ecffc Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 17 Jun 2018 08:03:50 +0200 Subject: [PATCH 1/2] Disable hypothesis.HealthCheck.too_slow globally Fixes #364 --- conftest.py | 10 ++++++++++ tests/test_funcs.py | 5 +---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/conftest.py b/conftest.py index 046d04045..9f84c3451 100644 --- a/conftest.py +++ b/conftest.py @@ -4,6 +4,16 @@ import pytest +from hypothesis import HealthCheck, settings + + +def pytest_configure(config): + # HealthCheck.too_slow causes more trouble than good -- especially in CIs. + settings.register_profile( + "patience", settings(suppress_health_check=[HealthCheck.too_slow]) + ) + settings.load_profile("patience") + @pytest.fixture(scope="session") def C(): diff --git a/tests/test_funcs.py b/tests/test_funcs.py index 1d8524376..54995d128 100644 --- a/tests/test_funcs.py +++ b/tests/test_funcs.py @@ -8,7 +8,7 @@ import pytest -from hypothesis import HealthCheck, assume, given, settings +from hypothesis import assume, given from hypothesis import strategies as st import attr @@ -67,7 +67,6 @@ def test_nested_dicts(self, C): assert {"x": {1: {2: {"x": 1, "y": 2}}}, "y": None} == asdict(outer) @given(nested_classes, st.sampled_from(MAPPING_TYPES)) - @settings(suppress_health_check=[HealthCheck.too_slow]) def test_recurse_property(self, cls, dict_class): """ Property tests for recursive asdict. @@ -196,7 +195,6 @@ def test_recurse(self, C, tuple_factory): ) == astuple(C(C(1, 2), C(3, 4)), tuple_factory=tuple_factory) @given(nested_classes, st.sampled_from(SEQUENCE_TYPES)) - @settings(suppress_health_check=[HealthCheck.too_slow]) def test_recurse_property(self, cls, tuple_class): """ Property tests for recursive astuple. @@ -215,7 +213,6 @@ def assert_proper_tuple_class(obj, obj_tuple): assert_proper_tuple_class(obj, obj_tuple) @given(nested_classes, st.sampled_from(SEQUENCE_TYPES)) - @settings(suppress_health_check=[HealthCheck.too_slow]) def test_recurse_retain(self, cls, tuple_class): """ Property tests for asserting collection types are retained. From 8737b3af79a34fc7cb57fa6894cd39f65b4b61e3 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 17 Jun 2018 08:13:26 +0200 Subject: [PATCH 2/2] Add newsfragment --- changelog.d/364.change.rst | 1 + changelog.d/396.change.rst | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelog.d/364.change.rst create mode 100644 changelog.d/396.change.rst diff --git a/changelog.d/364.change.rst b/changelog.d/364.change.rst new file mode 100644 index 000000000..0791b1fb8 --- /dev/null +++ b/changelog.d/364.change.rst @@ -0,0 +1 @@ +The test suite now runs with ``hypothesis.HealthCheck.too_slow`` disabled to prevent CI breakage on slower computers. diff --git a/changelog.d/396.change.rst b/changelog.d/396.change.rst new file mode 100644 index 000000000..0791b1fb8 --- /dev/null +++ b/changelog.d/396.change.rst @@ -0,0 +1 @@ +The test suite now runs with ``hypothesis.HealthCheck.too_slow`` disabled to prevent CI breakage on slower computers.