MCPcopy Index your code
hub / github.com/python/cpython / test_correct_directory_verbose

Method test_correct_directory_verbose

Lib/test/test_tabnanny.py:172–194  ·  view source on GitHub ↗

Directory containing few error free python source code files. Because order of files returned by `os.lsdir()` is not fixed, verify the existence of each output lines at `stdout` using `in` operator. `verbose` mode of `tabnanny.verbose` asserts `stdout`.

(self)

Source from the content-addressed store, hash-verified

170 self.verify_tabnanny_check(file_path)
171
172 def test_correct_directory_verbose(self):
173 """Directory containing few error free python source code files.
174
175 Because order of files returned by `os.lsdir()` is not fixed, verify the
176 existence of each output lines at `stdout` using `in` operator.
177 `verbose` mode of `tabnanny.verbose` asserts `stdout`.
178 """
179 with tempfile.TemporaryDirectory() as tmp_dir:
180 lines = [f"{tmp_dir!r}: listing directory\n",]
181 file1 = TemporaryPyFile(SOURCE_CODES["error_free"], directory=tmp_dir)
182 file2 = TemporaryPyFile(SOURCE_CODES["error_free"], directory=tmp_dir)
183 with file1 as file1_path, file2 as file2_path:
184 for file_path in (file1_path, file2_path):
185 lines.append(f"{file_path!r}: Clean bill of health.\n")
186
187 tabnanny.verbose = 1
188 with captured_stdout() as stdout, captured_stderr() as stderr:
189 tabnanny.check(tmp_dir)
190 stdout = stdout.getvalue()
191 for line in lines:
192 with self.subTest(line=line):
193 self.assertIn(line, stdout)
194 self.assertEqual(stderr.getvalue(), "")
195
196 def test_correct_directory(self):
197 """Directory which contains few error free python source code files."""

Callers

nothing calls this directly

Calls 9

captured_stdoutFunction · 0.90
captured_stderrFunction · 0.90
TemporaryPyFileClass · 0.85
assertInMethod · 0.80
appendMethod · 0.45
checkMethod · 0.45
getvalueMethod · 0.45
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected