@@ -854,8 +854,7 @@ p.f(1)
854854from p.a import f
855855[file p/a.py]
856856def f(x: str) -> None: pass
857- [delete p/__init__.py.2]
858- [delete p/a.py.2]
857+ [delete p.2]
859858[out]
860859main:2: error: Argument 1 to "f" has incompatible type "int"; expected "str"
861860==
@@ -870,7 +869,7 @@ p.a.f(1)
870869[file p/a.py]
871870def f(x: str) -> None: pass
872871[delete p/a.py.2]
873- [delete p/__init__.py .3]
872+ [delete p.3]
874873[builtins fixtures/module.pyi]
875874[out]
876875main:3: error: Argument 1 to "f" has incompatible type "int"; expected "str"
@@ -884,52 +883,55 @@ main:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missin
884883main:2: error: Cannot find implementation or library stub for module named "p"
885884
886885[case testDeletePackage4]
886+ # flags: --no-namespace-packages
887887import p.a
888888p.a.f(1)
889889[file p/a.py]
890890def f(x: str) -> None: pass
891891[file p/__init__.py]
892892[delete p/__init__.py.2]
893- [delete p/a.py .3]
893+ [delete p.3]
894894[out]
895- main:2 : error: Argument 1 to "f" has incompatible type "int"; expected "str"
895+ main:3 : error: Argument 1 to "f" has incompatible type "int"; expected "str"
896896==
897- main:1 : error: Cannot find implementation or library stub for module named "p.a"
898- main:1 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
899- main:1 : error: Cannot find implementation or library stub for module named "p"
897+ main:2 : error: Cannot find implementation or library stub for module named "p.a"
898+ main:2 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
899+ main:2 : error: Cannot find implementation or library stub for module named "p"
900900==
901- main:1 : error: Cannot find implementation or library stub for module named "p.a"
902- main:1 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
903- main:1 : error: Cannot find implementation or library stub for module named "p"
901+ main:2 : error: Cannot find implementation or library stub for module named "p.a"
902+ main:2 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
903+ main:2 : error: Cannot find implementation or library stub for module named "p"
904904
905905[case testDeletePackage5]
906- # cmd1: mypy main p/a.py p/__init__.py
907- # cmd2: mypy main p/a.py
908- # cmd3: mypy main
906+ # flags: --no-namespace-packages
907+ # cmd1: mypy -m main -m p.a -m p.__init__
908+ # cmd2: mypy -m main -m p.a
909+ # cmd3: mypy -m main
909910
910911import p.a
911912p.a.f(1)
912913[file p/a.py]
913914def f(x: str) -> None: pass
914915[file p/__init__.py]
915916[delete p/__init__.py.2]
916- [delete p/a.py .3]
917+ [delete p.3]
917918[out]
918- main:6 : error: Argument 1 to "f" has incompatible type "int"; expected "str"
919+ main:7 : error: Argument 1 to "f" has incompatible type "int"; expected "str"
919920==
920- main:5 : error: Cannot find implementation or library stub for module named "p.a"
921- main:5 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
922- main:5 : error: Cannot find implementation or library stub for module named "p"
921+ main:6 : error: Cannot find implementation or library stub for module named "p.a"
922+ main:6 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
923+ main:6 : error: Cannot find implementation or library stub for module named "p"
923924==
924- main:5 : error: Cannot find implementation or library stub for module named "p.a"
925- main:5 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
926- main:5 : error: Cannot find implementation or library stub for module named "p"
925+ main:6 : error: Cannot find implementation or library stub for module named "p.a"
926+ main:6 : note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
927+ main:6 : error: Cannot find implementation or library stub for module named "p"
927928
928929
929930[case testDeletePackage6]
930- # cmd1: mypy p/a.py p/b.py p/__init__.py
931- # cmd2: mypy p/a.py p/b.py
932- # cmd3: mypy p/a.py p/b.py
931+ # flags: --no-namespace-packages
932+ # cmd1: mypy -m p.a -m p.b -m p.__init__
933+ # cmd2: mypy -m p.a -m p.b
934+ # cmd3: mypy -m p.a -m p.b
933935[file p/a.py]
934936def f(x: str) -> None: pass
935937[file p/b.py]
0 commit comments