MCPcopy Index your code
hub / github.com/python/cpython / test_walk_bad_dir

Method test_walk_bad_dir

Lib/test/test_pathlib/test_pathlib.py:3533–3551  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3531 os_helper.rmtree(self.base)
3532
3533 def test_walk_bad_dir(self):
3534 errors = []
3535 walk_it = self.walk_path.walk(on_error=errors.append)
3536 root, dirs, files = next(walk_it)
3537 self.assertEqual(errors, [])
3538 dir1 = 'SUB1'
3539 path1 = root / dir1
3540 path1new = (root / dir1).with_suffix(".new")
3541 path1.rename(path1new)
3542 try:
3543 roots = [r for r, _, _ in walk_it]
3544 self.assertTrue(errors)
3545 self.assertNotIn(path1, roots)
3546 self.assertNotIn(path1new, roots)
3547 for dir2 in dirs:
3548 if dir2 != dir1:
3549 self.assertIn(root / dir2, roots)
3550 finally:
3551 path1new.rename(path1)
3552
3553 def test_walk_many_open_files(self):
3554 depth = 30

Callers

nothing calls this directly

Calls 7

assertTrueMethod · 0.80
assertNotInMethod · 0.80
assertInMethod · 0.80
walkMethod · 0.45
assertEqualMethod · 0.45
with_suffixMethod · 0.45
renameMethod · 0.45

Tested by

no test coverage detected