Skip to content

Commit f03160a

Browse files
authored
Merge pull request python-trio#144 from Zac-HD/upstream-hypothesis
Upstream some Hypothesis support into Trio
2 parents e930e6f + 9b9801f commit f03160a

File tree

10 files changed

+57
-34
lines changed

10 files changed

+57
-34
lines changed

.github/workflows/ci.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
16+
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
1717
steps:
1818
- name: Checkout
1919
uses: actions/checkout@v2
@@ -35,7 +35,7 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
python: ['pypy-3.7', '3.7', 'pypy-3.8', '3.8', 'pypy-3.9', '3.9', '3.10', '3.11']
38+
python: ['pypy-3.8', '3.8', 'pypy-3.9', '3.9', 'pypy-3.10', '3.10', '3.11', '3.12']
3939
check_formatting: ['0']
4040
check_docs: ['0']
4141
extra_name: ['']
@@ -74,7 +74,7 @@ jobs:
7474
strategy:
7575
fail-fast: false
7676
matrix:
77-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
77+
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
7878
steps:
7979
- name: Checkout
8080
uses: actions/checkout@v2

.readthedocs.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# https://docs.readthedocs.io/en/latest/config-file/index.html
22
version: 2
33

4+
build:
5+
os: ubuntu-22.04
6+
tools:
7+
python: "3.9"
8+
49
formats:
510
- htmlzip
611
- epub
712

813
python:
9-
version: 3.7
1014
install:
1115
- requirements: docs-requirements.txt
1216

docs-requirements.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ towncrier != 19.9.0,!= 21.3.0
1111
# pytest-trio's own dependencies
1212
trio >= 0.22.0
1313
outcome >= 1.1.0
14-
pytest >= 7.2.0
14+
pytest >= 8.2.0

docs-requirements.txt

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.8
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile docs-requirements.in
66
#
@@ -12,7 +12,6 @@ attrs==22.1.0
1212
# via
1313
# -r docs-requirements.in
1414
# outcome
15-
# pytest
1615
# trio
1716
babel==2.10.3
1817
# via sphinx
@@ -40,8 +39,6 @@ idna==3.4
4039
# trio
4140
imagesize==1.4.1
4241
# via sphinx
43-
importlib-metadata==5.0.0
44-
# via sphinx
4542
incremental==22.10.0
4643
# via towncrier
4744
iniconfig==1.1.1
@@ -60,13 +57,13 @@ packaging==21.3
6057
# via
6158
# pytest
6259
# sphinx
63-
pluggy==1.0.0
60+
pluggy==1.5.0
6461
# via pytest
6562
pygments==2.13.0
6663
# via sphinx
6764
pyparsing==3.0.9
6865
# via packaging
69-
pytest==7.2.0
66+
pytest==8.2.2
7067
# via -r docs-requirements.in
7168
pytz==2022.5
7269
# via babel
@@ -109,8 +106,6 @@ trio==0.22.0
109106
# via -r docs-requirements.in
110107
urllib3==1.26.12
111108
# via requests
112-
zipp==3.10.0
113-
# via importlib-metadata
114109

115110
# The following packages are considered to be unsafe in a requirements file:
116111
# setuptools

newsfragments/143.misc.rst

+3
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.

newsfragments/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ message and PR description, which are a description of the change as
99
relevant to people working on the code itself.)
1010

1111
Each file should be named like ``<ISSUE>.<TYPE>.rst``, where
12-
``<ISSUE>`` is an issue numbers, and ``<TYPE>`` is one of:
12+
``<ISSUE>`` is an issue number, and ``<TYPE>`` is one of:
1313

1414
* ``feature``
1515
* ``bugfix``

pytest_trio/plugin.py

+1-14
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(

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
packages=find_packages(),
1717
entry_points={"pytest11": ["trio = pytest_trio.plugin"]},
1818
install_requires=[
19-
"trio >= 0.22.0", # for ExceptionGroup support
19+
"trio >= 0.25.1", # for upstream Hypothesis integration
2020
"outcome >= 1.1.0",
2121
"pytest >= 7.2.0", # for ExceptionGroup support
2222
],
@@ -34,11 +34,11 @@
3434
"Operating System :: MacOS :: MacOS X",
3535
"Operating System :: Microsoft :: Windows",
3636
"Programming Language :: Python :: 3 :: Only",
37-
"Programming Language :: Python :: 3.7",
3837
"Programming Language :: Python :: 3.8",
3938
"Programming Language :: Python :: 3.9",
4039
"Programming Language :: Python :: 3.10",
4140
"Programming Language :: Python :: 3.11",
41+
"Programming Language :: Python :: 3.12",
4242
"Programming Language :: Python :: Implementation :: CPython",
4343
"Programming Language :: Python :: Implementation :: PyPy",
4444
"Topic :: System :: Networking",

test-requirements.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pytest>=8.2.2
2+
pytest-cov>=5.0.0
3+
hypothesis>=6.108.0

test-requirements.txt

+34-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1-
pytest==7.2.0
2-
pytest-cov==4.0.0
3-
hypothesis==6.56.4
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
4+
#
5+
# pip-compile test-requirements.in
6+
#
7+
attrs==23.2.0
8+
# via hypothesis
9+
coverage[toml]==7.6.0
10+
# via pytest-cov
11+
exceptiongroup==1.2.2
12+
# via
13+
# hypothesis
14+
# pytest
15+
hypothesis==6.108.0
16+
# via -r test-requirements.in
17+
iniconfig==2.0.0
18+
# via pytest
19+
packaging==24.1
20+
# via pytest
21+
pluggy==1.5.0
22+
# via pytest
23+
pytest==8.2.2
24+
# via
25+
# -r test-requirements.in
26+
# pytest-cov
27+
pytest-cov==5.0.0
28+
# via -r test-requirements.in
29+
sortedcontainers==2.4.0
30+
# via hypothesis
31+
tomli==2.0.1
32+
# via
33+
# coverage
34+
# pytest

0 commit comments

Comments
 (0)