#650 Add Type-Check to test#870
Conversation
florimondmanca
left a comment
There was a problem hiding this comment.
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.
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.
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! |
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.2 to 3.1.3. - [Release notes](https://github.com/pallets/jinja/releases) - [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst) - [Commits](pallets/jinja@3.1.2...3.1.3) --- updated-dependencies: - dependency-name: jinja2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This add type-check to tests
Refs #650