-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
stubtest: rewrite #8325
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
stubtest: rewrite #8325
Conversation
This will cause us to assume python version is sys.version_info, which is the behaviour we want, since we're comparing things to the runtime
Rework things to avoid false positives / order nitpicks Make checks involving *args, **kwargs a little more sophisticated
is_subtype would always return False, leading to false positives most times TypeVars were used for parameters with default values. We still have some false positives from Unions of TypeVars, but that's less bad, and could almost all be fixed by adjusting the overload of Mapping.get
I'm done making changes; this is ready for review 😄 |
Okay, I lied. But only because I didn't expect to run into a Python bug. (Up till now I'd just been testing on my Mac, bug is Linux-only because it manifests with |
(This comment contains a patch that detects issues with base classes. Unfortunately, in practice it's noisy; I've contributed the valuable ones I spotted to typeshed. Sticking this here, in case I need to find it again)
|
Oops, didn't notice that one of those broke CI |
3adb1a2
to
0b89ff9
Compare
Before I merge this, I'd like to make sure that there's something in CI that makes sure stubtest doesn't get broken by changes in other areas of mypy. From https://travis-ci.org/python/mypy/jobs/641260424?utm_medium=notification&utm_source=github_status it looks like the mypy self-check already covers stubtest, which is good. Would it be possible to add a test that invokes stubtest on either the typeshed submodule or on some special test file? The latter would have the advantage that you could also test for error cases, but the former might be easier to set up. |
I can do that. Currently we don't package stubtest, so tox knows nothing about it. I think it would make sense to treat this like stubgen, so move it into mypy/ and add a console script entry_point in setup.py? (I'd also prefer to do it in a separate diff, but can keep stacking on to this too) |
Sure, that sounds good. I'll merge this PR now so that you can do the testing in a followup PR. |
Hello,
I recently embarked on a rewrite of stubtest with the goal of improving our testing of typeshed. For some more context, please refer to python/typeshed#754 That issue also links examples of output and of typeshed issues this has detected.
Some notes about what this change contains:
My goal with this draft PR is to solicit code review and feedback from folks familiar with mypy internals. Some notes:
Anyway, let me know your thoughts!
Resolves #3329