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

Method test_walk_bad_dir

Lib/test/test_os.py:1628–1647  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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')

Callers

nothing calls this directly

Calls 8

walkMethod · 0.95
nextFunction · 0.85
assertTrueMethod · 0.80
assertNotInMethod · 0.80
assertInMethod · 0.80
assertEqualMethod · 0.45
joinMethod · 0.45
renameMethod · 0.45

Tested by

no test coverage detected