I know this is not a standard thing to do across Encode projects, but I've been wondering if it would be worth starting to type-hint our tests.
I've seen at least two instances of this recently:
My rationale is based on two aspects:
The main counter-argument, I suppose, is that type hinting tests is tedious. I think that's fair, but I believe the two pro's above make it compelling.
Thoughts?
Alternatively, we could tweak the mypy config:
[mypy]
files = httpx, tests
ignore_missing_imports = True
disallow_untyped_defs = False
check_untyped_defs = True
[mypy-httpx]
disallow_untyped_defs = True
check_untyped_defs = False
Running this locally raises 141 errors, but mostly on internal APIs, so, hmm.
I think this is a great idea, would like to work on this. Since I am pretty new to httpx, adding these type hints to the tests will give me a better picture of how httpx works under the hood.
I think this is still a good idea, though it's a bit of busy work to upgrade our existing test code.
Let's perhaps just remind ourselves to add types whenever we add/touch existing tests?
@florimondmanca I see a lot of merged PR. I guess you should close this ? 😄
I think there’s one small last step which would be to add tests/ to the mypy arguments in the check script. :-) Once this is enforced then yup, we can close this off.
I am currently working on a different Good First Issue PR and when that is done. I would be happy to pick up what's remaining in this PR so we can close this one too. 😄