-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
stubtest regression in 0.930 handling local/relative imports? #11843
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
Comments
Yeah, this is an expected result of #11634 stubtest works by comparing the results of a) statically analysing pyi files, b) importing the actual module and using runtime introspection. stubtest has to figure out which attributes of the runtime module should have definitions in the stub. If there's an In the case The behaviour change between stubtest 0.921 and 0.930 is that (in the absence of This is pretty important for user expectations, see this additional test case that fails with 0.921: https://github.com/python/mypy/pull/11634/files#diff-64c76dab759f5e184794b869cd69f8a5afa97380e693e98b980025d5487dcfc1R662-R665 It was surprising to users that missing I see your project uses stubtest's allowlist functionality, which you could reuse here ( |
It does look somewhat annoying for your project (although a |
Thanks for the detailed explanation! It sounds like I should look into setting up |
Quick update: I found a straightforward workaround, which was just to repeat the That seemed to make sense:
The change also meant I could re-enable the latest (0.930) stubtest, with no need for any new config flag – so maybe close this out? Thanks again! |
Happy to hear and happy new year! :-) |
Bug Report
The 0.930 version of
stubtest
doesn't seem to handle local/relative imports (from .local import thing
) that worked with 0.921.To Reproduce
Expected Behavior
Expect the behaviour of 0.921 – stubtest passes:
Actual Behavior
stubtest
0.931 shows an error relating to the local import:Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: