pyright with strict typeCheckingMode reports error: Type of "add_response" is partially unknown because of **matchers
Closed this issue · 1 comments
dolfandringa commented
with pytest_httpx_bug_demo.py
from pytest_httpx import HTTPXMock
import httpx
def test_something(httpx_mock: HTTPXMock):
httpx_mock.add_response(method="GET", url="http://www.google.com")
with httpx.Client() as client:
client.get("http://www.google.com")
running pyright in stict mode with the following pyproject.toml
[tool.pyright]
typeCheckingMode = "strict"
results in the following error
pyright pytest_httpx_bug_demo.py
/home/[redacted]/pytest_httpx_bug_demo.py
/home/[redacted]/pytest_httpx_bug_demo.py:6:5 - error: Type of "add_response" is partially unknown
Type of "add_response" is "(status_code: int = 200, http_version: str = "HTTP/1.1", headers: Headers | Dict[str, str] | Dict[bytes, bytes] | Sequence[Tuple[str, str]] | Sequence[Tuple[bytes, bytes]] = None, content: bytes | None = None, text: str | None = None, html: str | None = None, stream: Any = None, json: Any = None, **matchers: Unknown) -> None" (reportUnknownMemberType)
1 error, 0 warnings, 0 informations
This is because the **marchers
arguments don't have any type declaration. Changing that into **matchers: Any
would addresses that.
Colin-b commented
Release 0.24.0 is now available on pypi, with the proper typing