Skip to content

Commit

Permalink
Upstreamed Hypothesis support
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Jul 14, 2024
1 parent 8eac276 commit e263790
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
3 changes: 3 additions & 0 deletions newsfragments/143.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Move some Hypothesis support into Trio itself, via the new plugins system.
As a result, ``pytest-trio`` will not import Hypothesis, while still
integrating seamlessly if _you_ import it.
15 changes: 0 additions & 15 deletions pytest_trio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,6 @@
# Basic setup
################################################################

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


def pytest_addoption(parser):
parser.addini(
"trio_mode",
Expand Down

0 comments on commit e263790

Please sign in to comment.