Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for recursion limit
  • Loading branch information
zmievsa committed Dec 16, 2022
commit fb5a4c7af1331a9f916032f6fa15779ec2cacc70
10 changes: 10 additions & 0 deletions Lib/test/test_pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from unittest import mock

from test.support import import_helper
from test.support import infinite_recursion
from test.support import is_emscripten, is_wasi
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
Expand Down Expand Up @@ -2766,6 +2767,15 @@ def test_walk_many_open_files(self):
self.assertEqual(next(it), expected)
path = path / 'd'

def test_walk_above_recursion_limit(self):
base = pathlib.Path(os_helper.TESTFN, 'deep')
path = pathlib.Path(base, *(['d']*50))
path.mkdir(parents=True)

with infinite_recursion(25):
list(base.walk())
list(base.walk(top_down=False))


class PathTest(_BasePathTest, unittest.TestCase):
cls = pathlib.Path
Expand Down