Skip to content

stubtest --custom-typeshed-dir broken on master and 0.980 #13654

Closed
@AlexWaygood

Description

@AlexWaygood

Bug Report

c0372cc appears to have broken stubtest if you use it with --custom-typeshed-dir. Attempting to use stubtest with --custom-typeshed-dir pointing to a local clone of typeshed will result in the following message (or something like it):

error: not checking stubs due to failed mypy compile:
mypy: "..\typeshed\stdlib\builtins.pyi" shadows library module "builtins"
note: A user-defined top-level module with name "builtins" is not supported

Notes on the bug:

  • I haven't been able to reproduce this using "mypy core", only with stubtest.
  • The bug exists on both mypy master and mypy release-0.980.
  • The bug exists if you use a relative path or an absolute path to point to a clone of typeshed.
  • The bug exists if you use the --check-typeshed flag, as well as if you don't.
  • I bisected to c0372cc (Fix custom typeshed dir handling by is_typeshed_file() #13629)

Cc. @ilevkivskyi, @jhance, @hauntsaninja

To Reproduce

Any of the following will reproduce:

  • (venv) python -m mypy.stubtest typed_ast --custom-typeshed-dir relative/path/to/typeshed
  • (venv) python -m mypy.stubtest typed_ast --custom-typeshed-dir absolute/path/to/typeshed
  • (venv) python -m mypy.stubtest --check-typeshed --custom-typeshed-dir relative/path/to/typeshed
  • (venv) python -m mypy.stubtest --check-typeshed --custom-typeshed-dir absolute/path/to/typeshed

Expected Behavior

Stubtest with --custom-typeshed-dir would work on mypy master.

Actual Behavior

Stubtest with --custom-typeshed-dir did not work on mypy master.

Your Environment

  • Python version used: 3.10.6
  • Operating system and version: Windows

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions