Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ optional = true
[tool.poetry.group.develop.dependencies]
pre-commit = ">=2.20,<5.0"
requests = "*"
typing_extensions = { version = ">=4.0", markers = "python_version < '3.11'" }
Sphinx = ">=5.1.1,<8.0.0"
sphinx-rtd-theme = ">=1,<4"
reno = "*"
Expand Down
14 changes: 7 additions & 7 deletions pytest_httpserver/blocking_httpserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class BlockingRequestHandler(RequestHandlerBase):
This class should only be instantiated inside the implementation of the :py:class:`BlockingHTTPServer`.
"""

def __init__(self):
self.response_queue = Queue()
def __init__(self) -> None:
self.response_queue: Queue[Response] = Queue()

def respond_with_response(self, response: Response):
def respond_with_response(self, response: Response) -> None:
self.response_queue.put_nowait(response)


Expand All @@ -59,11 +59,11 @@ class BlockingHTTPServer(HTTPServerBase):

def __init__(
self,
host=DEFAULT_LISTEN_HOST,
port=DEFAULT_LISTEN_PORT,
host: str = DEFAULT_LISTEN_HOST,
port: int = DEFAULT_LISTEN_PORT,
ssl_context: SSLContext | None = None,
timeout: int = 30,
):
) -> None:
super().__init__(host, port, ssl_context)
self.timeout = timeout
self.request_queue: Queue[Request] = Queue()
Expand All @@ -76,7 +76,7 @@ def assert_request(
data: str | bytes | None = None,
data_encoding: str = "utf-8",
headers: Mapping[str, str] | None = None,
query_string: None | QueryMatcher | str | bytes | Mapping = None,
query_string: None | QueryMatcher | str | bytes | Mapping[str, str] = None,
header_value_matcher: HeaderValueMatcher | None = None,
json: Any = UNDEFINED,
timeout: int = 30,
Expand Down
8 changes: 4 additions & 4 deletions pytest_httpserver/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Chain:
similar to reduce.
"""

def __init__(self, *args: Callable[[Request, Response], Response]):
def __init__(self, *args: Callable[[Request, Response], Response]) -> None:
"""
:param *args: callable objects specified in the same order they should
be called.
Expand All @@ -43,13 +43,13 @@ class Delay:
Delays returning the response
"""

def __init__(self, seconds: float):
def __init__(self, seconds: float) -> None:
"""
:param seconds: seconds to sleep before returning the response
"""
self._seconds = seconds

def _sleep(self):
def _sleep(self) -> None:
"""
Sleeps for the seconds specified in the constructor
"""
Expand All @@ -65,7 +65,7 @@ def __call__(self, _request: Request, response: Response) -> Response:


class Garbage:
def __init__(self, prefix_size: int = 0, suffix_size: int = 0):
def __init__(self, prefix_size: int = 0, suffix_size: int = 0) -> None:
"""
Adds random bytes to the beginning or to the end of the response data.

Expand Down
Loading