stubtest: add tests #8380
stubtest: add tests #8380
Conversation
27499cb
to
5e1e846
|
Hmmmmm.... more mypyc issues.
|
|
So without any success I tried a) replacing
Maybe we need to change typeshed stubs? eg https://github.com/python/typeshed/blob/master/stdlib/2and3/builtins.pyi#L42 (update: couldn't get changing this and the return type of Is there an easy mypyc workaround? (Using |
|
Tried a couple things, gave up, came back and found the big off switch. Let me know if you know how to actually fix mypyc's complaints. |
|
Thanks, this is great! As for the mypyc issue, I don't have any special insight. Maybe casting to |
|
Just took a look at the fresh mypyc errors (after adding stubtest to MYPYC_BLACKLIST). 3.5.1 and 3.7 have different failures. I can't repro the 3.5.1 one (but I'm using 3.5.9). So maybe not a mypyc issue? Scanned through changelog for py35, but nothing popped up. Maybe one of you would recognise it if it were a Python version issue. I'll investigate more later.
The 3.7 one is a legitimate complaint. I abused
|
|
I tried with 3.5.3 and couldn't repro either. Unfortunately, I can't get a working version of 3.5.2 or 3.5.1 (pyenv fails with ssl issues and manually built python runs into zlib issues). Do we still need to be specifically compatible with 3.5.1? https://github.com/python/mypy/blob/master/.travis.yml#L26 (line is from 2016) 3.5.1 is over four years old, and EOL for 3.5 is in seven months. Update: seems to work in travis using 3.5.3 as well, https://travis-ci.org/hauntsaninja/mypy/builds/647868830 |
See python#8380 for motivation
|
Looks like virtualenv had a new release today that's broken various different parts of the build. I'll attempt to fix in another PR. |
Fixes some false negatives and a minor false positive. Makes the logic more readable and improve comments.
Dumb mistake causing false negatives, mainly seems to surface a lot of platform differences
To comply with project style
Doesn't make a difference to typeshed
This is nicer too
EAFP, since bytes and enums should work, and default value error messages can be more informative with literal types
|
Phew, all green now! |
| @@ -100,6 +100,9 @@ def run(self): | |||
| # We don't populate __file__ properly at the top level or something? | |||
| # Also I think there would be problems with how we generate version.py. | |||
| 'version.py', | |||
|
|
|||
| # Written by someone who doesn't know how to deal with mypyc | |||
| 'stubtest.py', | |||
JelleZijlstra
Feb 13, 2020
Member
Is this still necessary?
Is this still necessary?
hauntsaninja
Feb 13, 2020
Author
Collaborator
Yeah, I never figured out how to get vars / dict to work. This is the big off switch I mentioned in #8380 (comment)
Yeah, I never figured out how to get vars / dict to work. This is the big off switch I mentioned in #8380 (comment)
JelleZijlstra
Feb 13, 2020
Member
Makes sense, I inferred from some of the changes since that you'd figured out a workaround. I merged this change now and hopefully we'll eventually find a way to remove the special-casing.
Makes sense, I inferred from some of the changes since that you'd figured out a workaround. I merged this change now and hopefully we'll eventually find a way to remove the special-casing.
hauntsaninja
Feb 13, 2020
Author
Collaborator
The workarounds were for the bug in early Python 3.5s and a valid mypyc complaint from another module.
I’ll try Sully’s suggestion to see if we can remove stubtest from the blacklist.
The workarounds were for the bug in early Python 3.5s and a valid mypyc complaint from another module.
I’ll try Sully’s suggestion to see if we can remove stubtest from the blacklist.
|
Sorry, I had meant to double back on this and it slipped through the cracks. mypyc really needs to implement a system for overriding lies in typeshed (as discussed mypyc/mypyc#676). I think the workaround here would be to do If you want to follow-up with another attempt to get it to work, I'll review it quickly. But it isn't particularly critical. |
Following up from #8325
Test coverage is 91% from unit tests, and 97% if you count
StubtestIntegration.test_typeshed.