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

Method test_module_not_found

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

Source from the content-addressed store, hash-verified

106
107 @unittest.skipIf(sys.platform == "win32", "clean up fails on Windows")
108 def test_module_not_found(self) -> None:
109 current = os.getcwd()
110 captured_output = io.StringIO()
111 sys.stdout = captured_output
112 with tempfile.TemporaryDirectory() as tmp:
113 try:
114 os.chdir(tmp)
115 self.make_file(tmp, "mymodule.py", content="import a")
116 opts = parse_options(["-m", "mymodule"])
117 collect_build_targets(opts, mypy_options(opts))
118 assert captured_output.getvalue() == ""
119 finally:
120 sys.stdout = sys.__stdout__
121 os.chdir(current)
122
123 def make_file(self, *path: str, content: str = "") -> None:
124 file = os.path.join(*path)

Callers

nothing calls this directly

Calls 4

make_fileMethod · 0.95
parse_optionsFunction · 0.90
collect_build_targetsFunction · 0.90
mypy_optionsFunction · 0.90

Tested by

no test coverage detected