https://github.com/python/cpython/commit/2339e7cff745271f0e4a919573a347ab2bc1c2e9
commit: 2339e7cff745271f0e4a919573a347ab2bc1c2e9
branch: main
author: Malcolm Smith <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-03-10T23:00:33+01:00
summary:
gh-116057: Use relative recursion limits when testing os.walk() and Path.walk()
(#116058)
Replace test.support.set_recursion_limit with test.support.infinite_recursion.
files:
M Lib/test/test_os.py
M Lib/test/test_pathlib/test_pathlib.py
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 3b2d5fccc30f3c..ae8b405dab50fc 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -34,7 +34,7 @@
from test.support import import_helper
from test.support import os_helper
from test.support import socket_helper
-from test.support import set_recursion_limit
+from test.support import infinite_recursion
from test.support import warnings_helper
from platform import win32_is_iot
@@ -1496,7 +1496,7 @@ def test_walk_many_open_files(self):
def test_walk_above_recursion_limit(self):
depth = 50
os.makedirs(os.path.join(self.walk_path, *(['d'] * depth)))
- with set_recursion_limit(depth - 5):
+ with infinite_recursion(depth - 5):
all = list(self.walk(self.walk_path))
sub2_path = self.sub2_tree[0]
diff --git a/Lib/test/test_pathlib/test_pathlib.py
b/Lib/test/test_pathlib/test_pathlib.py
index 7e44ae61a5eba7..6509c08d227346 100644
--- a/Lib/test/test_pathlib/test_pathlib.py
+++ b/Lib/test/test_pathlib/test_pathlib.py
@@ -15,7 +15,7 @@
from test.support import import_helper
from test.support import is_emscripten, is_wasi
-from test.support import set_recursion_limit
+from test.support import infinite_recursion
from test.support import os_helper
from test.support.os_helper import TESTFN, FakePath
from test.test_pathlib import test_pathlib_abc
@@ -1199,7 +1199,7 @@ def test_walk_above_recursion_limit(self):
path = base.joinpath(*(['d'] * directory_depth))
path.mkdir(parents=True)
- with set_recursion_limit(recursion_limit):
+ with infinite_recursion(recursion_limit):
list(base.walk())
list(base.walk(top_down=False))
@@ -1239,7 +1239,7 @@ def test_glob_above_recursion_limit(self):
path = base.joinpath(*(['d'] * directory_depth))
path.mkdir(parents=True)
- with set_recursion_limit(recursion_limit):
+ with infinite_recursion(recursion_limit):
list(base.glob('**/'))
def test_glob_pathlike(self):
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]