(self)
| 1831 | self.assertRaises(StopIteration, next, walk_it) |
| 1832 | |
| 1833 | def test_walk_bad_dir(self): |
| 1834 | # Walk top-down. |
| 1835 | errors = [] |
| 1836 | walk_it = self.walk(self.walk_path, onerror=errors.append) |
| 1837 | root, dirs, files = next(walk_it) |
| 1838 | self.assertEqual(errors, []) |
| 1839 | dir1 = 'SUB1' |
| 1840 | path1 = os.path.join(root, dir1) |
| 1841 | path1new = os.path.join(root, dir1 + '.new') |
| 1842 | os.rename(path1, path1new) |
| 1843 | try: |
| 1844 | roots = [r for r, d, f in walk_it] |
| 1845 | self.assertTrue(errors) |
| 1846 | self.assertNotIn(path1, roots) |
| 1847 | self.assertNotIn(path1new, roots) |
| 1848 | for dir2 in dirs: |
| 1849 | if dir2 != dir1: |
| 1850 | self.assertIn(os.path.join(root, dir2), roots) |
| 1851 | finally: |
| 1852 | os.rename(path1new, path1) |
| 1853 | |
| 1854 | def test_walk_bad_dir2(self): |
| 1855 | walk_it = self.walk('nonexisting') |
nothing calls this directly
no test coverage detected