Skip to content

Commit 6f21c20

Browse files
committed
doc: add doc.patch to fix typing.TYPE_CHECKING blocks for sphinx
1 parent d12c55e commit 6f21c20

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
sys.path.insert(0, os.path.abspath(".."))
2626

27+
import doc.patch
2728

2829
# -- General configuration ------------------------------------------------
2930

doc/patch.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# this is required to make sphinx able to find references for classes put inside
2+
# typing.TYPE_CHECKING block
3+
4+
from ssl import SSLContext
5+
6+
from werkzeug.wrappers import Request
7+
from werkzeug.wrappers import Response
8+
9+
import pytest_httpserver.blocking_httpserver
10+
import pytest_httpserver.httpserver
11+
12+
pytest_httpserver.httpserver.SSLContext = SSLContext
13+
pytest_httpserver.blocking_httpserver.SSLContext = SSLContext
14+
15+
pytest_httpserver.blocking_httpserver.Request = Request
16+
pytest_httpserver.blocking_httpserver.Response = Response

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ markers = [
8787
]
8888

8989
[tool.mypy]
90-
files = ["pytest_httpserver", "scripts", "tests", "doc"]
90+
files = ["pytest_httpserver", "scripts", "tests"]
9191
implicit_reexport = false
9292

9393

tests/test_release.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ def test_sdist_contents(build: Build, version: str):
183183
"howto.rst",
184184
"index.rst",
185185
"Makefile",
186+
"patch.py",
186187
"tutorial.rst",
187188
"upgrade.rst",
188189
},

0 commit comments

Comments
 (0)