MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_correct_directory_verbose

Method test_correct_directory_verbose

Lib/test/test_tabnanny.py:173–195  ·  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

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

Tested by

no test coverage detected