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

Method test_walk_many_open_files

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

Source from the content-addressed store, hash-verified

1714 self.assertIsInstance(errors[0], NotADirectoryError)
1715
1716 def test_walk_many_open_files(self):
1717 depth = 30
1718 base = os.path.join(os_helper.TESTFN, 'deep')
1719 p = os.path.join(base, *(['d']*depth))
1720 os.makedirs(p)
1721
1722 iters = [self.walk(base, topdown=False) for j in range(100)]
1723 for i in range(depth + 1):
1724 expected = (p, ['d'] if i else [], [])
1725 for it in iters:
1726 self.assertEqual(next(it), expected)
1727 p = os.path.dirname(p)
1728
1729 iters = [self.walk(base, topdown=True) for j in range(100)]
1730 p = base
1731 for i in range(depth + 1):
1732 expected = (p, ['d'] if i < depth else [], [])
1733 for it in iters:
1734 self.assertEqual(next(it), expected)
1735 p = os.path.join(p, 'd')
1736
1737 def test_walk_above_recursion_limit(self):
1738 depth = 50

Callers

nothing calls this directly

Calls 4

walkMethod · 0.95
nextFunction · 0.85
joinMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected