Skip to content

Commit 86e94ae

Browse files
committed
skip hanging or very slow tests
1 parent 34d36d3 commit 86e94ae

20 files changed

+56
-7
lines changed

hypothesis-python/tests/cover/test_database_backend.py

+1
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@ def test_database_listener_memory():
659659

660660

661661
@skipif_emscripten
662+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ages")
662663
def test_database_listener_background_write():
663664
_database_conforms_to_listener_api(
664665
lambda path: BackgroundWriteDatabase(InMemoryExampleDatabase()),

hypothesis-python/tests/cover/test_lookup.py

+5
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ def __repr__(self):
619619
return f"Tree({self.left}, {self.right})"
620620

621621

622+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~19 mins")
622623
@given(tree=st.builds(Tree))
623624
def test_resolving_recursive_type(tree):
624625
assert isinstance(tree, Tree)
@@ -979,6 +980,10 @@ def test_no_byteswarning(_):
979980
pass
980981

981982

983+
@pytest.mark.skipif(
984+
settings._current_profile == "crosshair",
985+
reason="Crosshair doesn't generate the Decimal('snan'), so this runs for hours",
986+
)
982987
def test_hashable_type_unhashable_value():
983988
# Decimal("snan") is not hashable; we should be able to generate it.
984989
# See https://github.com/HypothesisWorks/hypothesis/issues/2320

hypothesis-python/tests/cover/test_lookup_py38.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import pytest
1717

18-
from hypothesis import example, given, strategies as st
18+
from hypothesis import example, given, settings, strategies as st
1919
from hypothesis.errors import InvalidArgument
2020
from hypothesis.internal.reflection import (
2121
convert_positional_arguments,
@@ -126,6 +126,7 @@ class Node:
126126
right: typing.Union["Node", int]
127127

128128

129+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~11 mins")
129130
@given(st.builds(Node))
130131
def test_can_resolve_recursive_dataclass(val):
131132
assert isinstance(val, Node)

hypothesis-python/tests/cover/test_provisional_strategies.py

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def test_invalid_domain_arguments(max_length, max_element_length):
5656
)
5757

5858

59+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~300s each")
5960
@pytest.mark.parametrize("max_length", [None, 4, 8, 255])
6061
@pytest.mark.parametrize("max_element_length", [None, 1, 2, 4, 8, 63])
6162
def test_valid_domains_arguments(max_length, max_element_length):

hypothesis-python/tests/cover/test_randoms.py

+1
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def test_randbytes_have_right_length(rnd, n):
325325
assert len(rnd.randbytes(n)) == n
326326

327327

328+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes hours")
328329
@given(any_random)
329330
def test_can_manage_very_long_ranges_with_step(rnd):
330331
i = rnd.randrange(0, 2**256, 3)

hypothesis-python/tests/cover/test_regex.py

+2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def pred(s):
104104
_test_matching_pattern(category, isvalidchar=pred, is_unicode=is_unicode)
105105

106106

107+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~30s each")
107108
@pytest.mark.parametrize(
108109
"pattern",
109110
[
@@ -190,6 +191,7 @@ def test_any_with_dotall_generate_newline_binary(pattern):
190191
find_any(st.from_regex(pattern), lambda s: s == b"\n", settings(max_examples=10**6))
191192

192193

194+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~30s each")
193195
@pytest.mark.parametrize(
194196
"pattern",
195197
["\\d", "[\\d]", "[^\\D]", "\\w", "[\\w]", "[^\\W]", "\\s", "[\\s]", "[^\\S]"],

hypothesis-python/tests/cover/test_sampled_from.py

+4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ def test_efficient_dicts_with_sampled_keys(x):
9999
assert set(x) == set(range(50))
100100

101101

102+
@pytest.mark.skipif(
103+
settings._current_profile == "crosshair",
104+
reason="takes ~10 mins and raises Unsatisfiable",
105+
)
102106
@given(
103107
st.lists(
104108
st.tuples(st.sampled_from(range(20)), st.builds(list)),

hypothesis-python/tests/cover/test_stateful.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,9 @@ def rule1(self, data):
13251325
assert data
13261326

13271327

1328-
TestLotsOfEntropyPerStepMachine = LotsOfEntropyPerStepMachine.TestCase
1328+
@pytest.mark.skipif(Settings._current_profile == "crosshair", reason="takes hours")
1329+
def test_lots_of_entropy():
1330+
run_state_machine_as_test(LotsOfEntropyPerStepMachine)
13291331

13301332

13311333
def test_flatmap():

hypothesis-python/tests/nocover/test_characters.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import string
1212
from encodings.aliases import aliases
1313

14-
from hypothesis import given, strategies as st
14+
import pytest
15+
16+
from hypothesis import given, settings, strategies as st
1517

1618
IDENTIFIER_CHARS = string.ascii_letters + string.digits + "_"
1719

@@ -47,6 +49,7 @@ def _enc(cdc):
4749
assert len(lots_of_encodings) > 100 # sanity-check
4850

4951

52+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes 2000s")
5053
@given(data=st.data(), codec=st.sampled_from(lots_of_encodings))
5154
def test_can_constrain_characters_to_codec(data, codec):
5255
s = data.draw(st.text(st.characters(codec=codec), min_size=100))

hypothesis-python/tests/nocover/test_emails.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

11-
from hypothesis import given
11+
import pytest
12+
13+
from hypothesis import given, settings
1214
from hypothesis.strategies import emails, just
1315

1416

17+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~7 mins")
1518
@given(emails())
1619
def test_is_valid_email(address: str):
1720
local, at_, domain = address.rpartition("@")

hypothesis-python/tests/nocover/test_flatmap.py

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_flatmap_has_original_strategy_repr():
8585
assert repr(ints) in repr(ints_up)
8686

8787

88+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~6 mins")
8889
def test_mixed_list_flatmap():
8990
s = lists(booleans().flatmap(lambda b: booleans() if b else text()))
9091

hypothesis-python/tests/nocover/test_from_type_recipe.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

11-
from hypothesis import given, strategies as st
11+
import pytest
12+
13+
from hypothesis import given, settings, strategies as st
1214
from hypothesis.strategies._internal.types import _global_type_lookup
1315

1416
from tests.common.debug import find_any
@@ -32,6 +34,7 @@ def everything_except(excluded_types):
3234
)
3335

3436

37+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~250s")
3538
@given(
3639
excluded_types=st.lists(
3740
st.sampled_from(TYPES), min_size=1, max_size=3, unique=True

hypothesis-python/tests/nocover/test_health_checks.py

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from hypothesis.internal.entropy import deterministic_PRNG
2121
from hypothesis.strategies._internal.lazy import LazyStrategy
2222

23+
pytestmark = pytest.mark.skipif(settings._current_profile == "crosshair", reason="slow")
24+
2325
large_strategy = st.binary(min_size=7000, max_size=7000)
2426
too_large_strategy = st.tuples(large_strategy, large_strategy)
2527

hypothesis-python/tests/nocover/test_lstar.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

11+
import pytest
12+
1113
import hypothesis.strategies as st
1214
from hypothesis import Phase, example, given, settings
1315
from hypothesis.internal.conjecture.dfa.lstar import LStar
@@ -20,6 +22,7 @@ def byte_order(draw):
2022
return ls[:n]
2123

2224

25+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes 300s")
2326
@example({0}, [1])
2427
@given(st.sets(st.integers(0, 255)), byte_order())
2528
# This test doesn't even use targeting at all, but for some reason the

hypothesis-python/tests/nocover/test_recursive.py

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import threading
1313
import warnings
1414

15+
import pytest
16+
1517
from hypothesis import HealthCheck, given, settings, strategies as st
1618

1719
from tests.common.debug import find_any, minimal
@@ -115,6 +117,7 @@ def test_can_form_sets_of_recursive_data():
115117
assert len(xs) == size
116118

117119

120+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="not threadsafe")
118121
def test_drawing_from_recursive_strategy_is_thread_safe():
119122
shared_strategy = st.recursive(
120123
st.integers(), lambda s: st.lists(s, max_size=2), max_leaves=20

hypothesis-python/tests/nocover/test_sampled_from.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import pytest
1717

18-
from hypothesis import given, strategies as st
18+
from hypothesis import given, settings, strategies as st
1919
from hypothesis.errors import InvalidArgument
2020
from hypothesis.internal.compat import bit_count
2121
from hypothesis.strategies._internal.strategies import SampledFromStrategy
@@ -130,6 +130,7 @@ def test_flags_minimizes_bit_count():
130130
)
131131

132132

133+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="takes ~10 mins")
133134
def test_flags_finds_all_bits_set():
134135
assert find_any(st.sampled_from(LargeFlag), lambda f: f == ~LargeFlag(0))
135136

hypothesis-python/tests/nocover/test_simple_strings.py

+5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010

1111
import unicodedata
1212

13+
import pytest
14+
1315
from hypothesis import given, settings
1416
from hypothesis.strategies import text
1517

1618

19+
@pytest.mark.skipif(
20+
settings._current_profile == "crosshair", reason="takes ~10 minutes"
21+
)
1722
@given(text(min_size=1, max_size=1))
1823
@settings(max_examples=2000)
1924
def test_does_not_generate_surrogates(t):

hypothesis-python/tests/nocover/test_targeting.py

+3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ def test(ls):
8383
assert score(enabled=True) > score(enabled=False)
8484

8585

86+
@pytest.mark.skipif(
87+
settings._current_profile == "crosshair", reason="takes ~15 minutes"
88+
)
8689
def test_issue_2395_regression():
8790
@given(d=st.floats().filter(lambda x: abs(x) < 1000))
8891
@settings(max_examples=1000, database=None)

hypothesis-python/tests/nocover/test_type_lookup_forward_ref.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212

1313
import pytest
1414

15-
from hypothesis import given, strategies as st
15+
from hypothesis import given, settings, strategies as st
1616
from hypothesis.errors import ResolutionFailed
1717

1818
from tests.common import utils
1919

2020
# Mutually-recursive types
2121
# See https://github.com/HypothesisWorks/hypothesis/issues/2722
2222

23+
pytestmark = pytest.mark.skipif(settings._current_profile == "crosshair", reason="slow")
24+
2325

2426
@given(st.data())
2527
def test_mutually_recursive_types_with_typevar(data):

hypothesis-python/tests/nocover/test_unusual_settings_configs.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

11+
import pytest
12+
1113
from hypothesis import HealthCheck, Verbosity, assume, given, settings, strategies as st
1214

1315

@@ -17,6 +19,7 @@ def test_single_example(n):
1719
pass
1820

1921

22+
@pytest.mark.skipif(settings._current_profile == "crosshair", reason="hangs/crashes")
2023
@settings(
2124
max_examples=1,
2225
database=None,

0 commit comments

Comments
 (0)