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)
| 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.""" |
nothing calls this directly
no test coverage detected