Skip to content

Commit a5c2658

Browse files
authored
Merge pull request #3047 from Zac-HD/with-pytest-randomly
Fix docs, and selftest compatibility with `pytest-randomly`
2 parents ccac436 + 31578c7 commit a5c2658

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hypothesis-python/docs/data.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ for your data type, returns a new strategy for it. So for example:
195195
... from pprint import pprint
196196
>>> json = recursive(
197197
... none() | booleans() | floats() | text(printable),
198-
... lambda children: lists(children, 1)
199-
... | dictionaries(text(printable), children, min_size=1),
198+
... lambda children: lists(children) | dictionaries(text(printable), children),
200199
... )
201200
>>> pprint(json.example())
202201
[[1.175494351e-38, ']', 1.9, True, False, '.M}Xl', ''], True]

hypothesis-python/tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import pytest
2222

23+
from hypothesis._settings import is_in_ci
2324
from hypothesis.internal.detection import is_hypothesis_test
2425

2526
from tests.common import TIME_INCREMENT
@@ -96,6 +97,12 @@ def pytest_runtest_call(item):
9697
# See: https://github.com/HypothesisWorks/hypothesis/issues/1919
9798
if not (hasattr(item, "obj") and is_hypothesis_test(item.obj)):
9899
yield
100+
elif "pytest_randomly" in sys.modules:
101+
# See https://github.com/HypothesisWorks/hypothesis/issues/3041 - this
102+
# branch exists to make it easier on external contributors, but should
103+
# never run in our CI (because that would disable the check entirely).
104+
assert not is_in_ci()
105+
yield
99106
else:
100107
# We start by peturbing the state of the PRNG, because repeatedly
101108
# leaking PRNG state resets state_after to the (previously leaked)

0 commit comments

Comments
 (0)