Skip to content

Commit ad1e856

Browse files
authored
Merge pull request #3112 from Zac-HD/sphinx-codeautolink
2 parents 710699c + 6ef129e commit ad1e856

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

hypothesis-python/docs/conf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"sphinx.ext.viewcode",
3333
"sphinx.ext.intersphinx",
3434
"hoverxref.extension",
35+
"sphinx_codeautolink",
3536
"sphinx_selective_exclude.eager_only",
3637
]
3738

@@ -94,6 +95,13 @@ def setup(app):
9495

9596
autodoc_mock_imports = ["numpy", "pandas", "redis"]
9697

98+
codeautolink_autodoc_inject = False
99+
codeautolink_global_preface = """
100+
from hypothesis import *
101+
import hypothesis.strategies as st
102+
from hypothesis.strategies import *
103+
"""
104+
97105
# This config value must be a dictionary of external sites, mapping unique
98106
# short alias names to a base URL and a prefix.
99107
# See http://sphinx-doc.org/ext/extlinks.html

hypothesis-python/docs/reproducing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ as follows:
140140
... pass
141141
...
142142
Falsifying example: test(f=nan)
143-
<BLANKLINE>
143+
144144
You can reproduce this example by temporarily adding @reproduce_failure(..., b'AAAA//AAAAAAAAEA') as a decorator on your test case
145145
146146
Adding the suggested decorator to the test should reproduce the failure (as

hypothesis-python/tests/ghostwriter/test_expected_output.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ def divide(a: int, b: int) -> float:
156156
),
157157
pytest.param(
158158
("magic_builtins", ghostwriter.magic(builtins)),
159-
# Signature of builtins.compile() changed in 3.8 and we use that version.
160-
marks=[pytest.mark.skipif(sys.version_info[:2] <= (3, 7), reason="")],
159+
marks=[
160+
pytest.mark.skipif(
161+
sys.version_info[:2] not in [(3, 8), (3, 9)],
162+
reason="compile arg new in 3.8, aiter and anext new in 3.10",
163+
)
164+
],
161165
),
162166
],
163167
ids=lambda x: x[0],
@@ -174,6 +178,6 @@ def test_ghostwriter_on_hypothesis(update_recorded_outputs):
174178
expected = get_recorded("hypothesis_module_magic", actual * update_recorded_outputs)
175179
# The py36 typing module has some different handling of generics (SearchStrategy)
176180
# and contents (collections.abc vs typing), but we can still check the code works.
177-
if sys.version_info[:2] > (3, 6):
181+
if (3, 6) < sys.version_info[:2] < (3, 10):
178182
assert actual == expected
179183
exec(expected, {"not_set": not_set})

requirements/tools.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ requests
2121
restructuredtext-lint
2222
shed
2323
sphinx
24+
sphinx-codeautolink
2425
sphinx-hoverxref
2526
sphinx-rtd-theme
2627
sphinx-selective-exclude

requirements/tools.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ backports.entry-points-selectable==1.1.0
2323
# via virtualenv
2424
bandit==1.7.0
2525
# via flake8-bandit
26+
beautifulsoup4==4.10.0
27+
# via sphinx-codeautolink
2628
black==21.9b0
2729
# via
2830
# blacken-docs
@@ -254,10 +256,15 @@ snowballstemmer==2.1.0
254256
# sphinx
255257
sortedcontainers==2.4.0
256258
# via hypothesis (hypothesis-python/setup.py)
259+
soupsieve==2.2.1
260+
# via beautifulsoup4
257261
sphinx==4.2.0
258262
# via
259263
# -r requirements/tools.in
264+
# sphinx-codeautolink
260265
# sphinx-rtd-theme
266+
sphinx-codeautolink==0.3.0
267+
# via -r requirements/tools.in
261268
sphinx-hoverxref==0.7b1
262269
# via -r requirements/tools.in
263270
sphinx-rtd-theme==1.0.0

tooling/src/hypothesistooling/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def run_tox(task, version):
364364
PY37 = "3.7.12"
365365
PY38 = PYMAIN = "3.8.12" # Sync PYMAIN minor version with GH Actions main.yml
366366
PY39 = "3.9.7"
367-
PY310 = "3.10-dev"
367+
PY310 = "3.10.0"
368368
PYPY36 = "pypy3.6-7.3.3"
369369
PYPY37 = "pypy3.7-7.3.5"
370370

0 commit comments

Comments
 (0)