Skip to content
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

Solve import cycles for mypy/expandtype.py and mypy/test/testtypes.py #15580

Merged
merged 1 commit into from
Jul 3, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Jul 3, 2023

Now it passes:

» pytest mypy/test/testtypes.py   
=================================== test session starts ===================================
platform darwin -- Python 3.11.3, pytest-7.3.2, pluggy-1.2.0
rootdir: /Users/sobolev/Desktop/mypy
configfile: pyproject.toml
plugins: cov-4.1.0, xdist-3.3.1
12 workers [116 items]    
.......................................s...................s....................... [ 71%]
.................................                                                   [100%]
============================= 114 passed, 2 skipped in 0.63s ==============================

I've also fixed this problem:

» python mypy/expandtype.py
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/mypy/mypy/expandtype.py", line 7, in <module>
    import mypy.type_visitor  # ruff: isort: skip
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/sobolev/Desktop/mypy/mypy/type_visitor.py", line 22, in <module>
    from mypy.types import (
  File "/Users/sobolev/Desktop/mypy/mypy/types.py", line 2968, in <module>
    from mypy.type_visitor import (  # noqa: F811
ImportError: cannot import name 'ALL_STRATEGY' from partially initialized module 'mypy.type_visitor' (most likely due to a circular import) (/Users/sobolev/Desktop/mypy/mypy/type_visitor.py)

Closes #15570

@github-actions
Copy link
Contributor

github-actions bot commented Jul 3, 2023

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@hauntsaninja hauntsaninja merged commit 2e9c9b4 into master Jul 3, 2023
@hauntsaninja hauntsaninja deleted the issue-15570 branch July 3, 2023 19:07
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.

Circular import in testtypes
2 participants