Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mypy test errors when using python runtests.py #17316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
charris opened this issue Sep 15, 2020 · 9 comments · Fixed by #17411
Closed

mypy test errors when using python runtests.py #17316

charris opened this issue Sep 15, 2020 · 9 comments · Fixed by #17411

Comments

@charris
Copy link
Member

charris commented Sep 15, 2020

I see 14 typing errors that seem related to the added stubs when simply using runtests.py in the usual way. I assume that I am missing something but have no idea what it is.

Reproducing code example:

import numpy as np
<< your code here >>

Error message:

Numpy/Python version information:

@mattip
Copy link
Member

mattip commented Sep 15, 2020

I am also seeing failures at commit 7b7e7fe in numpy/typing/tests/test_typing.py. The travis test installs numpy, then does mkdir -p empty; cd empty; python ../runtests.py Perhaps some of the data files are missing from the shipped wheel, or a package version is causing some test variants to be skipped? I see 50 dots in the successful run, so that implies 50 tests are being run, which is the same as my local run, but I get "36 failed, 14 passed, 1 warning in 203.63s"

For reference, a passing travis log shows these packages:

Successfully installed attrs-20.2.0 cffi-1.14.2 coverage-5.3 hypothesis-5.35.1 iniconfig-1.0.1 more-itertools-8.5.0 mypy-0.782 mypy-extensions-0.4.3 packaging-20.4 pluggy-0.13.1 py-1.9.0 pycparser-2.20 pyparsing-2.4.7 pytest-6.0.2 pytest-cov-2.10.1 pytz-2020.1 six-1.15.0 sortedcontainers-2.2.2 toml-0.10.1 typed-ast-1.4.1 typing-extensions-3.7.4.3

@mattip
Copy link
Member

mattip commented Sep 15, 2020

@BvB93 ping

@BvB93
Copy link
Member

BvB93 commented Sep 15, 2020

Locally I'm not seeing any typing-related errors when running either python runtests.py -t numpy/typing or the full test suit with mkdir -p empty; cd empty; python ../runtests.py. Am i missing something here?

@charris
Copy link
Member Author

charris commented Sep 15, 2020

python3.8 runtests.py -t numpy/typing fails for me. My Python version is 3.8.5.

@mattip
Copy link
Member

mattip commented Sep 15, 2020

Thanks for checking. It might be something from the package list in the details above. Locally I see these differences (all the others are the same, especially mypy*, typ*):

package my version travis version
attrs 19.3.0 20.2.0
cffi 1.14.1 1.14.2
coverage 5.2.1 5.3
hypothesis 5.33.0 5.35.1
more-itertools 8.4.0 8.5.0
pytest 6.0.1 6.0.2

@BvB93
Copy link
Member

BvB93 commented Sep 15, 2020

For reference (macOS, python 3.8.3):

package my version travis version
attrs 19.3.0 20.2.0
cffi 1.14.2 1.14.2
coverage 5.1 5.3
hypothesis 5.26.0 5.35.1
more-itertools 8.3.0 8.5.0
pytest 6.0.1 6.0.2

Could any of you show me an example of these failed test runs?
I'm curious as to whether they contain any useful information.

@mattip
Copy link
Member

mattip commented Sep 15, 2020

It seems to be some failure in mypy serializing? here is the output of the tests. The first assertion error is on line 1635 of that output.

@BvB93
Copy link
Member

BvB93 commented Sep 15, 2020

Yes, there is definitely something wrong with mypy itself here.
The AssertionError seems to be raised somewhere during the mypy.api() call, just before the actual typing tests themselves are run.

The lack of actual error messages isn't helping either...

>   ???
E   AssertionError

@BvB93
Copy link
Member

BvB93 commented Sep 25, 2020

After clearing out my mypy cache I've finally managed to reproduce the issue, though only when running python ./runtests.py --mypy numpy. Apparently it's an unsolved bug related to import cycles (python/mypy#8481) and indeed, removing core from the imports seems to resolve the issue.

This is definitely something to keep an eye out for in the future, especially once annotations are added for public sub-modules.

BvB93 pushed a commit to BvB93/numpy that referenced this issue Oct 7, 2020
Prevents mypy crashes related to import cycles.

See numpy#17316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants