Skip to content

Commit 31578c7

Browse files
committed
Selftest with pytest-randomly
By disabling our selftest checks iff we're NOT in CI, and pytest-randomly is installed.
1 parent 9e50870 commit 31578c7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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)