Skip to content

Import cycle with type aliasing causes invalid "Invalid type" #5275

Closed
@emmatyping

Description

@emmatyping

Running stub checks with typeshed at fb92ee8 on master yielded the following:

[ethanhs@towerofart mypy]$ pytest -k testsamples
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /home/ethanhs/mypy, inifile: pytest.ini
plugins: xdist-1.22.2, forked-0.2, cov-2.5.1
gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2] / gw4 [2] / gw5 [2] / gw6 [2] / gw7 [2]
scheduling tests via LoadScheduling
.F                                                                       [100%]
=================================== FAILURES ===================================
___________________________ SamplesSuite.test_stubs ____________________________
[gw2] linux -- Python 3.6.5 /usr/bin/python
Sample check failed
----------------------------- Captured stdout call -----------------------------
typeshed/third_party/2and3/click/core.pyi:337: error: Invalid type "click.types._ConvertibleType"
typeshed/third_party/2and3/click/core.pyi:416: error: Invalid type "click.types._ConvertibleType"
===================== 1 failed, 1 passed in 13.15 seconds ======================

Ivan pointed out there is an import cycle, and it seems the cycle and type aliasing is giving mypy trouble.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions