@@ -64,6 +64,21 @@ mypy_path = ./tmp/dir:./tmp/other_dir
64
64
main:3: error: Cannot find module named 'pkg_or_ns.b'
65
65
main:3: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
66
66
67
+ [case testConflictingPackageAndNamespaceImportPackageLaterInPath]
68
+ # flags: --config-file tmp/mypy.ini
69
+ import pkg_or_ns.a
70
+ import pkg_or_ns.b
71
+ [file mypy.ini]
72
+ [[mypy]
73
+ namespace_packages = True
74
+ mypy_path = ./tmp/other_dir:./tmp/dir
75
+ [file dir/pkg_or_ns/__init__.py]
76
+ [file dir/pkg_or_ns/a.py]
77
+ [file other_dir/pkg_or_ns/b.py]
78
+ [out]
79
+ main:3: error: Cannot find module named 'pkg_or_ns.b'
80
+ main:3: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
81
+
67
82
[case testConflictingModuleAndNamespace]
68
83
# flags: --config-file tmp/mypy.ini
69
84
from mod_or_ns import a
@@ -76,7 +91,19 @@ mypy_path = ./tmp/dir:./tmp/other_dir
76
91
a = None
77
92
[file other_dir/mod_or_ns/b.py]
78
93
79
- [case testeNamespaceInsidePackage]
94
+ [case testConflictingModuleAndNamespaceModuleLaterInPath]
95
+ # flags: --config-file tmp/mypy.ini
96
+ from mod_or_ns import a
97
+ from mod_or_ns import b # E: Module 'mod_or_ns' has no attribute 'b'
98
+ [file mypy.ini]
99
+ [[mypy]
100
+ namespace_packages = True
101
+ mypy_path = ./tmp/other_dir:./tmp/dir
102
+ [file dir/mod_or_ns.py]
103
+ a = None
104
+ [file other_dir/mod_or_ns/b.py]
105
+
106
+ [case testNamespaceInsidePackage]
80
107
# flags: --config-file tmp/mypy.ini
81
108
from pkg.ns import a
82
109
[file mypy.ini]
0 commit comments