-
-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#650 Add Type-Check to test #870
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
It actually occurs to me that we're not running mypy on the tests
folder yet. Ideally we'd need to add a new step to scripts/check
for mypy tests/
with the appropriate options to silence any errors for files that aren't type-checked yet. Any ideas?
@pytest.mark.asyncio | ||
async def test_get_invalid_url(server): | ||
async def test_get_invalid_url(server: Server) -> None: | ||
with pytest.raises(httpx.InvalidURL): | ||
await httpx.get("invalid://example.org") | ||
await httpx.get("invalid://example.org") # type:ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so this entire test should really not be an async
one — the high-level API is sync-only.
def test_post_byte_iterator(server): | ||
def data(): | ||
def test_post_byte_iterator(server: Server) -> None: | ||
def data() -> typing.Generator[bytes, None, None]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we prefer this more relaxed style, in line with our other typing usage in this repo?
def data() -> typing.Generator[bytes, None, None]: | |
def data() -> typing.Iterator[bytes]: |
Hi there 👋 Going to close this for now as this has gone stale now, and there are some pending proposals to improve how we type check tests, cf #991… Thank you so much for putting time into this! |
This add type-check to tests
Refs #650