MCPcopy Index your code
hub / github.com/python/mypy / test_packages_found

Method test_packages_found

mypy/test/teststubgen.py:82–105  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

80
81 @unittest.skipIf(sys.platform == "win32", "clean up fails on Windows")
82 def test_packages_found(self) -> None:
83 current = os.getcwd()
84 with tempfile.TemporaryDirectory() as tmp:
85 try:
86 os.chdir(tmp)
87 os.mkdir("pack")
88 self.make_file("pack", "__init__.py", content="from . import a, b")
89 self.make_file("pack", "a.py")
90 self.make_file("pack", "b.py")
91 opts = parse_options(["-p", "pack"])
92 py_mods, pyi_mods, c_mods = collect_build_targets(opts, mypy_options(opts))
93 assert_equal(pyi_mods, [])
94 assert_equal(c_mods, [])
95 files = {os.path.relpath(mod.path or "FAIL") for mod in py_mods}
96 assert_equal(
97 files,
98 {
99 os.path.join("pack", "__init__.py"),
100 os.path.join("pack", "a.py"),
101 os.path.join("pack", "b.py"),
102 },
103 )
104 finally:
105 os.chdir(current)
106
107 @unittest.skipIf(sys.platform == "win32", "clean up fails on Windows")
108 def test_module_not_found(self) -> None:

Callers

nothing calls this directly

Calls 6

make_fileMethod · 0.95
parse_optionsFunction · 0.90
collect_build_targetsFunction · 0.90
mypy_optionsFunction · 0.90
assert_equalFunction · 0.90
joinMethod · 0.45

Tested by

no test coverage detected