Skip to content

Commit

Permalink
de-flake coverage
Browse files Browse the repository at this point in the history
fixes #3968, for good this time
  • Loading branch information
Zac-HD committed May 13, 2024
1 parent 88c80f7 commit ca4297b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
1 change: 0 additions & 1 deletion hypothesis-python/src/hypothesis/extra/pandas/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ def data_frames(
def rows_only(draw):
index = draw(index_strategy)

@check_function
def row():
result = draw(rows)
check_type(abc.Iterable, result, "draw(row)")
Expand Down
19 changes: 2 additions & 17 deletions hypothesis-python/src/hypothesis/strategies/_internal/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
is_typed_named_tuple,
)
from hypothesis.internal.conjecture.utils import calc_label_from_cls, check_sample
from hypothesis.internal.coverage import IN_COVERAGE_TESTS, description_stack
from hypothesis.internal.entropy import get_seeder_and_restorer
from hypothesis.internal.floats import float_of
from hypothesis.internal.observability import TESTCASE_CALLBACKS
Expand Down Expand Up @@ -1758,22 +1757,8 @@ def __init__(self, definition, args, kwargs):
self.args = args
self.kwargs = kwargs

if IN_COVERAGE_TESTS:
# We do a bit of a dance here to ensure that whatever 'outer' description
# stack we might have, doesn't affect the validation code internal to the
# strategy we're drawing from. Otherwise, we'd get flaky fails like #3968.
def do_draw(self, data):
prev = description_stack[:]
try:
description_stack.clear()
return self.definition(data.draw, *self.args, **self.kwargs)
finally:
description_stack[:] = prev

else: # pragma: no cover

def do_draw(self, data):
return self.definition(data.draw, *self.args, **self.kwargs)
def do_draw(self, data):
return self.definition(data.draw, *self.args, **self.kwargs)

def calc_label(self):
return calc_label_from_cls(self.definition)
Expand Down

0 comments on commit ca4297b

Please sign in to comment.