Skip to content

stubtest: show path to stub file #13342

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

Merged
merged 2 commits into from
Aug 6, 2022
Merged

Conversation

hauntsaninja
Copy link
Collaborator

No description provided.

@hauntsaninja
Copy link
Collaborator Author

hauntsaninja commented Aug 6, 2022

(mypy-qyes) ~/dev/mypy stubtest-mod λ cat x.py
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    x: int
else:
    def x(): ...

(mypy-qyes) ~/dev/mypy stubtest-mod λ stubtest x
error: x.x variable differs from runtime type def () -> Any
Stub: at line 4 in file /Users/shantanu/dev/mypy/x.py
builtins.int
Runtime: at line 6 in file /Users/shantanu/dev/mypy/x.py
<function x at 0x102c9e170>

Found 1 error (checked 1 module)

(mypy-qyes) ~/dev/mypy stubtest-mod λ cat z.py
def stub_posonly(number, text): pass

(mypy-qyes) ~/dev/mypy stubtest-mod λ cat z.pyi
def stub_posonly_570(number: int, /, text: str) -> None: ...

(mypy-qyes) ~/dev/mypy stubtest-mod λ stubtest z
error: z.stub_posonly is not present in stub
Stub: in file /Users/shantanu/dev/mypy/z.pyi
MISSING
Runtime: at line 1 in file /Users/shantanu/dev/mypy/z.py
<function stub_posonly at 0x100de9f30>

error: z.stub_posonly_570 is not present at runtime
Stub: at line 1 in file /Users/shantanu/dev/mypy/z.pyi
def (builtins.int, text: builtins.str)
Runtime:
MISSING

Found 2 errors (checked 1 module)

@hauntsaninja hauntsaninja merged commit 3aa9296 into python:master Aug 6, 2022
@hauntsaninja hauntsaninja deleted the stubtest-mod branch August 6, 2022 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant