[case testTypedPkgNoSitePkgsIgnoredImports] # pkgs: typedpkg # flags: --no-site-packages from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [file mypy.ini] \[mypy] ignore_missing_imports = True [out] testTypedPkgNoSitePkgsIgnoredImports.py:6: note: Revealed type is "Any" [case testTypedPkgSimple] # pkgs: typedpkg from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [out] testTypedPkgSimple.py:5: note: Revealed type is "tuple[str, ...]" [case testTypedPkgSimplePackageSearchPath] # pkgs: typedpkg # flags: -p typedpkg.pkg [out] [case testTypedPkg_config_nositepackages] # pkgs: typedpkg from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [file mypy.ini] \[mypy] no_site_packages=True [out] testTypedPkg_config_nositepackages.py:2: error: Cannot find implementation or library stub for module named "typedpkg.sample" testTypedPkg_config_nositepackages.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports testTypedPkg_config_nositepackages.py:3: error: Cannot find implementation or library stub for module named "typedpkg" testTypedPkg_config_nositepackages.py:5: note: Revealed type is "Any" [case testTypedPkg_args_nositepackages] # pkgs: typedpkg # flags: --no-site-packages from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [out] testTypedPkg_args_nositepackages.py:3: error: Cannot find implementation or library stub for module named "typedpkg.sample" testTypedPkg_args_nositepackages.py:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports testTypedPkg_args_nositepackages.py:4: error: Cannot find implementation or library stub for module named "typedpkg" testTypedPkg_args_nositepackages.py:6: note: Revealed type is "Any" [case testTypedPkgStubs] # pkgs: typedpkg-stubs from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [out] testTypedPkgStubs.py:3: error: Module "typedpkg" has no attribute "dne" testTypedPkgStubs.py:5: note: Revealed type is "list[str]" [case testStubPrecedence] # pkgs: typedpkg, typedpkg-stubs from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [out] testStubPrecedence.py:5: note: Revealed type is "list[str]" [case testTypedPkgSimpleEditable] # pkgs: typedpkg; editable from typedpkg.sample import ex from typedpkg import dne a = ex(['']) reveal_type(a) [out] testTypedPkgSimpleEditable.py:5: note: Revealed type is "tuple[str, ...]" [case testTypedPkgNamespaceImportFrom] # pkgs: typedpkg, typedpkg_ns_a from typedpkg.pkg.aaa import af from typedpkg_ns.a.bbb import bf from typedpkg_ns.a.dne import dne af("abc") bf(False) dne(123) af(False) bf(2) dne("abc") [out] testTypedPkgNamespaceImportFrom.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.a.dne" testTypedPkgNamespaceImportFrom.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports testTypedPkgNamespaceImportFrom.py:10: error: Argument 1 to "af" has incompatible type "bool"; expected "str" testTypedPkgNamespaceImportFrom.py:11: error: Argument 1 to "bf" has incompatible type "int"; expected "bool" [case testTypedPkgNamespaceImportAs] # pkgs: typedpkg, typedpkg_ns_a import typedpkg.pkg.aaa as nm; af = nm.af import typedpkg_ns.a.bbb as am; bf = am.bf from typedpkg_ns.a.dne import dne af("abc") bf(False) dne(123) af(False) bf(2) dne("abc") [out] testTypedPkgNamespaceImportAs.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.a.dne" testTypedPkgNamespaceImportAs.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports testTypedPkgNamespaceImportAs.py:10: error: Argument 1 has incompatible type "bool"; expected "str" testTypedPkgNamespaceImportAs.py:11: error: Argument 1 has incompatible type "int"; expected "bool" [case testTypedPkgNamespaceRegImport] # pkgs: typedpkg, typedpkg_ns_a import typedpkg.pkg.aaa; af = typedpkg.pkg.aaa.af import typedpkg_ns.a.bbb; bf = typedpkg_ns.a.bbb.bf from typedpkg_ns.a.dne import dne af("abc") bf(False) dne(123) af(False) bf(2) dne("abc") [out] testTypedPkgNamespaceRegImport.py:4: error: Cannot find implementation or library stub for module named "typedpkg_ns.a.dne" testTypedPkgNamespaceRegImport.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports testTypedPkgNamespaceRegImport.py:10: error: Argument 1 has incompatible type "bool"; expected "str" testTypedPkgNamespaceRegImport.py:11: error: Argument 1 has incompatible type "int"; expected "bool" -- This is really testing the test framework to make sure incremental works [case testPep561TestIncremental] # pkgs: typedpkg import a [file a.py] [file a.py.2] 1 + 'no' [out] [out2] a.py:1: error: Unsupported operand types for + ("int" and "str") [case testTypedPkgNamespaceRegFromImportTwice] # pkgs: typedpkg_ns_a from typedpkg_ns import a -- dummy should trigger a second iteration [file dummy.py.2] [out] [out2] [case testNamespacePkgWStubs] # pkgs: typedpkg_ns_a, typedpkg_ns_b, typedpkg_ns_b-stubs # flags: --no-namespace-packages import typedpkg_ns.a.bbb as a import typedpkg_ns.b.bbb as b a.bf(False) b.bf(False) a.bf(1) b.bf(1) import typedpkg_ns.whatever as c # type: ignore[import-untyped] [out] testNamespacePkgWStubs.py:4: error: Skipping analyzing "typedpkg_ns.b.bbb": module is installed, but missing library stubs or py.typed marker testNamespacePkgWStubs.py:4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports testNamespacePkgWStubs.py:4: error: Skipping analyzing "typedpkg_ns.b": module is installed, but missing library stubs or py.typed marker testNamespacePkgWStubs.py:7: error: Argument 1 to "bf" has incompatible type "int"; expected "bool" [case testNamespacePkgWStubsWithNamespacePackagesFlag] # pkgs: typedpkg_ns_a, typedpkg_ns_b, typedpkg_ns_b-stubs # flags: --namespace-packages import typedpkg_ns.a.bbb as a import typedpkg_ns.b.bbb as b a.bf(False) b.bf(False) a.bf(1) b.bf(1) [out] testNamespacePkgWStubsWithNamespacePackagesFlag.py:7: error: Argument 1 to "bf" has incompatible type "int"; expected "bool" testNamespacePkgWStubsWithNamespacePackagesFlag.py:8: error: Argument 1 to "bf" has incompatible type "int"; expected "bool" [case testMissingPytypedFlag] # pkgs: typedpkg_ns_b # flags: --namespace-packages --follow-untyped-imports import typedpkg_ns.b.bbb as b b.bf("foo", "bar") [out] testMissingPytypedFlag.py:4: error: Too many arguments for "bf" [case testTypedPkgNamespaceRegFromImportTwiceMissing] # pkgs: typedpkg_ns_a from typedpkg_ns import does_not_exist # type: ignore from typedpkg_ns import a -- dummy should trigger a second iteration [file dummy.py.2] [out] [out2] [case testTypedPkgNamespaceRegFromImportTwiceMissing2] # pkgs: typedpkg_ns_a from typedpkg_ns import does_not_exist # type: ignore from typedpkg_ns.a.bbb import bf -- dummy should trigger a second iteration [file dummy.py.2] [out] [out2] [case testTypedNamespaceSubpackage] # pkgs: typedpkg_ns_nested import our [file our/__init__.py] import our.bar import our.foo [file our/bar.py] from typedpkg_ns.b import Something [file our/foo.py] import typedpkg_ns.a [file dummy.py.2] [out] our/bar.py:1: error: Skipping analyzing "typedpkg_ns.b": module is installed, but missing library stubs or py.typed marker our/bar.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports [out2] our/bar.py:1: error: Skipping analyzing "typedpkg_ns.b": module is installed, but missing library stubs or py.typed marker our/bar.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports [case testPartiallyTypedNamespacePackageNoCrash] # pkgs: typedpkg_ns_nested import a [file a.py] import m1 import m2 [file a.py.2] import m1 [file m1.py] import typedpkg_ns.b # type: ignore [file m2.py] import typedpkg_ns.a [out] [out2]