summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2023-09-02 15:08:03 (GMT)
committerGitHub <noreply@github.com>2023-09-02 15:08:03 (GMT)
commitbdc3c884cdc90102ad68b6b55dc9b988e729ae35 (patch)
treedf837954084737e01fc497f7f3091066f708b4db /Lib/test/test_pathlib.py
parent594b00057e667e0d8d4e41748be056cdd829e919 (diff)
downloadcpython-bdc3c884cdc90102ad68b6b55dc9b988e729ae35.zip
cpython-bdc3c884cdc90102ad68b6b55dc9b988e729ae35.tar.gz
cpython-bdc3c884cdc90102ad68b6b55dc9b988e729ae35.tar.bz2
GH-78722: Raise exceptions from `pathlib.Path.iterdir()` without delay. (#107320)
`pathlib.Path.iterdir()` now immediately raises any `OSError` exception from `os.listdir()`, rather than waiting until its result is iterated over.
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 74deec8..09df3fe 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1766,7 +1766,7 @@ class PathTest(unittest.TestCase):
# __iter__ on something that is not a directory.
p = self.cls(BASE, 'fileA')
with self.assertRaises(OSError) as cm:
- next(p.iterdir())
+ p.iterdir()
# ENOENT or EINVAL under Windows, ENOTDIR otherwise
# (see issue #12802).
self.assertIn(cm.exception.errno, (errno.ENOTDIR,