Skip to content

Commit

Permalink
Disable hypothesis.HealthCheck.too_slow globally (#396)
Browse files Browse the repository at this point in the history
* Disable hypothesis.HealthCheck.too_slow globally

Fixes #364

* Add newsfragment
  • Loading branch information
hynek authored and Tinche committed Jun 17, 2018
1 parent 908cb01 commit 0693f47
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog.d/364.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The test suite now runs with ``hypothesis.HealthCheck.too_slow`` disabled to prevent CI breakage on slower computers.
1 change: 1 addition & 0 deletions changelog.d/396.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The test suite now runs with ``hypothesis.HealthCheck.too_slow`` disabled to prevent CI breakage on slower computers.
10 changes: 10 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
5 changes: 1 addition & 4 deletions tests/test_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 0693f47

Please sign in to comment.