qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v3 14/16] iotests/linters: Add workaround for mypy bug #9852


From: Hanna Reitz
Subject: Re: [PATCH v3 14/16] iotests/linters: Add workaround for mypy bug #9852
Date: Fri, 17 Sep 2021 13:16:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 16.09.21 06:09, John Snow wrote:
This one is insidious: if you use the invocation
"from {namespace} import {subpackage}" as mirror-top-perms does,
mypy will fail on every-other invocation *if* the package being
imported is a package.

Now, I could just edit mirror-top-perms to avoid this invocation, but
since I tripped on a landmine, I might as well head it off at the pass
and make sure nobody else trips on the same landmine.

It seems to have something to do with the order in which files are
checked as well, meaning the random order in which set(os.listdir())
produces the list of files to test will cause problems intermittently.

mypy >= 0.920 isn't released yet, so add this workaround for now.

See also:
  https://github.com/python/mypy/issues/11010
  https://github.com/python/mypy/issues/9852

Signed-off-by: John Snow <jsnow@redhat.com>
---
  tests/qemu-iotests/linters.py | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/tests/qemu-iotests/linters.py b/tests/qemu-iotests/linters.py
index 4df062a973..9c97324e87 100755
--- a/tests/qemu-iotests/linters.py
+++ b/tests/qemu-iotests/linters.py
@@ -100,6 +100,9 @@ def run_linters(
                  '--warn-unused-ignores',
                  '--no-implicit-reexport',
                  '--namespace-packages',
+                # Until we can use mypy >= 0.920, see
+                # https://github.com/python/mypy/issues/9852
+                '--no-incremental',
                  filename,
              ),

I’m afraid I still don’t really understand this, but I’m happy with this given as the reported workaround and you saying it works.

Reviewed-by: Hanna Reitz <hreitz@redhat.com>

Question is, when “can we use” mypy >= 0.920?  Should we check the version string and append this switch as required?

Hanna




reply via email to

[Prev in Thread] Current Thread [Next in Thread]