(self)
| 1626 | self.assertRaises(StopIteration, next, walk_it) |
| 1627 | |
| 1628 | def test_walk_bad_dir(self): |
| 1629 | # Walk top-down. |
| 1630 | errors = [] |
| 1631 | walk_it = self.walk(self.walk_path, onerror=errors.append) |
| 1632 | root, dirs, files = next(walk_it) |
| 1633 | self.assertEqual(errors, []) |
| 1634 | dir1 = 'SUB1' |
| 1635 | path1 = os.path.join(root, dir1) |
| 1636 | path1new = os.path.join(root, dir1 + '.new') |
| 1637 | os.rename(path1, path1new) |
| 1638 | try: |
| 1639 | roots = [r for r, d, f in walk_it] |
| 1640 | self.assertTrue(errors) |
| 1641 | self.assertNotIn(path1, roots) |
| 1642 | self.assertNotIn(path1new, roots) |
| 1643 | for dir2 in dirs: |
| 1644 | if dir2 != dir1: |
| 1645 | self.assertIn(os.path.join(root, dir2), roots) |
| 1646 | finally: |
| 1647 | os.rename(path1new, path1) |
| 1648 | |
| 1649 | def test_walk_bad_dir2(self): |
| 1650 | walk_it = self.walk('nonexisting') |
nothing calls this directly
no test coverage detected