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 <js...@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 <hre...@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