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

Method test_walk_many_open_files

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

Source from the content-addressed store, hash-verified

1919 self.assertIsInstance(errors[0], NotADirectoryError)
1920
1921 def test_walk_many_open_files(self):
1922 depth = 30
1923 base = os.path.join(os_helper.TESTFN, 'deep')
1924 p = os.path.join(base, *(['d']*depth))
1925 os.makedirs(p)
1926
1927 iters = [self.walk(base, topdown=False) for j in range(100)]
1928 for i in range(depth + 1):
1929 expected = (p, ['d'] if i else [], [])
1930 for it in iters:
1931 self.assertEqual(next(it), expected)
1932 p = os.path.dirname(p)
1933
1934 iters = [self.walk(base, topdown=True) for j in range(100)]
1935 p = base
1936 for i in range(depth + 1):
1937 expected = (p, ['d'] if i < depth else [], [])
1938 for it in iters:
1939 self.assertEqual(next(it), expected)
1940 p = os.path.join(p, 'd')
1941
1942 def test_walk_above_recursion_limit(self):
1943 depth = 50

Callers

nothing calls this directly

Calls 4

walkMethod · 0.95
joinMethod · 0.45
assertEqualMethod · 0.45
dirnameMethod · 0.45

Tested by

no test coverage detected