Can't make Mypy work with __init__.py aliases

Viewed 1095

Below is the minimal example of my problem:

[test/__init__.py]
from test.test1 import Test1
from test.test2 import Test2

[test/test1.py]
class Test1:
    pass

[test/test2.py]
from test import Test1

class Test2:
    pass

Mypy output for module or __init__.py:

test/test2.py:1: error: Module 'test' has no attribute 'Test1'

Code itself works well both on Python 2 and Python 3.

1 Answers
Related