Re: [PATCH v3 1/3] kunit: tool: surface and address more typing issues

From: Brendan Higgins
Date: Mon Jan 11 2021 - 16:16:10 EST


On Thu, Jan 7, 2021 at 3:48 PM Daniel Latypov <dlatypov@xxxxxxxxxx> wrote:
>
> The authors of this tool were more familiar with a different
> type-checker, https://github.com/google/pytype.
>
> That's open source, but mypy seems more prevalent (and runs faster).
> And unlike pytype, mypy doesn't try to infer types so it doesn't check
> unanotated functions.
>
> So annotate ~all functions in kunit tool to increase type-checking
> coverage.
> Note: per https://www.python.org/dev/peps/pep-0484/, `__init__()` should
> be annotated as `-> None`.
>
> Doing so makes mypy discover a number of new violations.
> Exclude main() since we reuse `request` for the different types of
> requests, which mypy isn't happy about.
>
> This commit fixes all but one error, where `TestSuite.status` might be
> None.
>
> Signed-off-by: Daniel Latypov <dlatypov@xxxxxxxxxx>
> Reviewed-by: David Gow <davidgow@xxxxxxxxxx>

Acked-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>