Re: [PATCH] kunit: tool: fix newly introduced typechecker errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 14, 2021 at 2:52 PM Daniel Latypov <dlatypov@xxxxxxxxxx> wrote:
>
> After upgrading mypy and pytype from pip, we see 2 new errors when
> running ./tools/testing/kunit/run_checks.py.
>
> Error #1: mypy and pytype
> They now deduce that importlib.util.spec_from_file_location() can return
> None and note that we're not checking for this.
>
> We validate that the arch is valid (i.e. the file exists) beforehand.
> Add in an `asssert spec is not None` to appease the checkers.
>
> Error #2: pytype bug https://github.com/google/pytype/issues/1057
> It doesn't like `from datetime import datetime`, specifically that a
> type shares a name with a module.
>
> We can workaround this by either
> * renaming the import or just using `import datetime`
> * passing the new `--fix-module-collisions` flag to pytype.
>
> We pick the first option for now because
> * the flag is quite new, only in the 2021.11.29 release.
> * I'd prefer if people can just run `pytype <file>`
>
> Signed-off-by: Daniel Latypov <dlatypov@xxxxxxxxxx>

Reviewed-by: Brendan Higgins <brendanhiggins@xxxxxxxxxx>



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux