diff --git a/hypothesis-python/tests/cover/test_lookup.py b/hypothesis-python/tests/cover/test_lookup.py index cc5e11c3f2..5653dc2c72 100644 --- a/hypothesis-python/tests/cover/test_lookup.py +++ b/hypothesis-python/tests/cover/test_lookup.py @@ -1149,6 +1149,7 @@ def test_resolves_builtin_types(t): @pytest.mark.parametrize("t", BUILTIN_TYPES, ids=lambda t: t.__name__) @given(data=st.data()) +@settings(max_examples=20) def test_resolves_forwardrefs_to_builtin_types(t, data): s = st.from_type(typing.ForwardRef(t.__name__)) v = data.draw(s) diff --git a/hypothesis-python/tests/nocover/test_characters.py b/hypothesis-python/tests/nocover/test_characters.py index f736f784f9..b0a1c9913a 100644 --- a/hypothesis-python/tests/nocover/test_characters.py +++ b/hypothesis-python/tests/nocover/test_characters.py @@ -57,6 +57,7 @@ def _enc(cdc): reason="takes 2000s; large & slow symbolic strings", ) @given(data=st.data(), codec=st.sampled_from(lots_of_encodings)) +@settings(max_examples=20) def test_can_constrain_characters_to_codec(data, codec): - s = data.draw(st.text(st.characters(codec=codec), min_size=100)) + s = data.draw(st.text(st.characters(codec=codec), min_size=50)) s.encode(codec) diff --git a/hypothesis-python/tests/nocover/test_health_checks.py b/hypothesis-python/tests/nocover/test_health_checks.py index e63ade92ca..abd9a78486 100644 --- a/hypothesis-python/tests/nocover/test_health_checks.py +++ b/hypothesis-python/tests/nocover/test_health_checks.py @@ -13,7 +13,7 @@ import pytest from pytest import raises -from hypothesis import HealthCheck, Phase, given, settings, strategies as st +from hypothesis import HealthCheck, Phase, given, seed, settings, strategies as st from hypothesis.errors import FailedHealthCheck from hypothesis.internal.conjecture.data import ConjectureData from hypothesis.internal.conjecture.engine import BUFFER_SIZE @@ -107,21 +107,22 @@ def test(n): test() -def test_does_not_trigger_health_check_when_most_examples_are_small(monkeypatch): - with deterministic_PRNG(): - for _ in range(100): - # Setting max_examples=11 ensures we have enough examples for the - # health checks to finish running, but cuts the generation short - # after that point to allow this test to run in reasonable time. - @settings(database=None, max_examples=11, phases=[Phase.generate]) - @given( - st.integers(0, 100).flatmap( - lambda n: st.binary( - min_size=min(n * 100, BUFFER_SIZE), max_size=n * 100 - ) +def test_does_not_trigger_health_check_when_most_examples_are_small(): + for i in range(10): + + @seed(i) + # Setting max_examples=11 ensures we have enough examples for the + # health checks to finish running, but cuts the generation short + # after that point to allow this test to run in reasonable time. + @settings(database=None, max_examples=11, phases=[Phase.generate]) + @given( + st.integers(0, 100).flatmap( + lambda n: st.binary( + min_size=min(n * 100, BUFFER_SIZE), max_size=n * 100 ) ) - def test(b): - pass + ) + def test(b): + pass - test() + test() diff --git a/hypothesis-python/tests/watchdog/test_database.py b/hypothesis-python/tests/watchdog/test_database.py index 1d1ec3ee5c..f3e253c830 100644 --- a/hypothesis-python/tests/watchdog/test_database.py +++ b/hypothesis-python/tests/watchdog/test_database.py @@ -45,7 +45,7 @@ def test_database_listener_directory(): # seen flaky on test-win; we get *three* of the same save events in the first # assertion, which...is baffling, and possibly a genuine bug (most likely in # watchdog). -@flaky(max_runs=2, min_passes=1) +@flaky(max_runs=5, min_passes=1) def test_database_listener_multiplexed(tmp_path): db = MultiplexedDatabase( InMemoryExampleDatabase(), DirectoryBasedExampleDatabase(tmp_path) @@ -96,7 +96,7 @@ def wait_for(condition, *, timeout=1, interval=0.01): # seen flaky on check-coverage (timeout in first wait_for) -@flaky(max_runs=2, min_passes=1) +@flaky(max_runs=5, min_passes=1) def test_database_listener_directory_explicit(tmp_path): db = DirectoryBasedExampleDatabase(tmp_path) events = [] @@ -167,7 +167,7 @@ def listener(event): # seen flaky on windows CI (timeout in wait_for) -@flaky(max_runs=2, min_passes=1) +@flaky(max_runs=5, min_passes=1) def test_database_listener_directory_move(tmp_path): db = DirectoryBasedExampleDatabase(tmp_path) events = []