Skip to content

Commit 080bc41

Browse files
committed
Upstreamed Hypothesis support
1 parent c6e1650 commit 080bc41

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

newsfragments/143.misc.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Move some Hypothesis support into Trio itself, via the new plugins system.
2+
As a result, ``pytest-trio`` will not import Hypothesis, while still
3+
integrating seamlessly if _you_ import it.

pytest_trio/plugin.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""pytest-trio implementation."""
2+
23
import sys
34
from functools import wraps, partial
45
from collections.abc import Coroutine, Generator
@@ -19,20 +20,6 @@
1920
# Basic setup
2021
################################################################
2122

22-
try:
23-
from hypothesis import register_random
24-
except ImportError: # pragma: no cover
25-
pass
26-
else:
27-
# On recent versions of Hypothesis, make the Trio scheduler deterministic
28-
# even though it uses a module-scoped Random instance. This works
29-
# regardless of whether or not the random_module strategy is used.
30-
register_random(trio._core._run._r)
31-
# We also have to enable determinism, which is disabled by default
32-
# due to a small performance impact - but fine to enable in testing.
33-
# See https://github.com/python-trio/trio/pull/890/ for details.
34-
trio._core._run._ALLOW_DETERMINISTIC_SCHEDULING = True
35-
3623

3724
def pytest_addoption(parser):
3825
parser.addini(

0 commit comments

Comments
 (0)