Skip to content

Commit

Permalink
doc: add doc.patch to fix typing.TYPE_CHECKING blocks for sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
csernazs committed Apr 3, 2024
1 parent 308fa66 commit 5a8d55e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

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

import doc.patch

# -- General configuration ------------------------------------------------

Expand Down
16 changes: 16 additions & 0 deletions doc/patch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# this is required to make sphinx able to find references for classes put inside
# typing.TYPE_CHECKING block

from ssl import SSLContext

from werkzeug.wrappers import Request
from werkzeug.wrappers import Response

import pytest_httpserver.blocking_httpserver
import pytest_httpserver.httpserver

pytest_httpserver.httpserver.SSLContext = SSLContext
pytest_httpserver.blocking_httpserver.SSLContext = SSLContext

pytest_httpserver.blocking_httpserver.Request = Request
pytest_httpserver.blocking_httpserver.Response = Response
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ markers = [
]

[tool.mypy]
files = ["pytest_httpserver", "scripts", "tests", "doc"]
files = ["pytest_httpserver", "scripts", "tests"]
implicit_reexport = false


Expand Down
1 change: 1 addition & 0 deletions tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def test_sdist_contents(build: Build, version: str):
"howto.rst",
"index.rst",
"Makefile",
"patch.py",
"tutorial.rst",
"upgrade.rst",
},
Expand Down

0 comments on commit 5a8d55e

Please sign in to comment.