summaryrefslogtreecommitdiff
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-01-06 09:51:42 -0800
committerGuido van Rossum <guido@python.org>2016-01-06 09:51:42 -0800
commitd54377d2cabe6a2057468136ba1f29f48d1b47b7 (patch)
tree8e421e052ef92c518e846cef2eae96be57972197 /Lib/test/test_pathlib.py
parentf34c3fe20c6e996b44014bf3e4e1fecc3739551c (diff)
parent6c2d33a258bb62bc74be4d848968c99c6fbfbba4 (diff)
downloadcpython-git-d54377d2cabe6a2057468136ba1f29f48d1b47b7.tar.gz
Issue #24120: Ignore PermissionError in pathlib.Path.[r]glob(). Ulrich Petri. (Merge 3.4->3.5)
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 1c53ab78ea..be1e04282d 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1199,26 +1199,33 @@ class _BasePathTest(object):
# (BASE)
# |
- # |-- dirA/
- # |-- linkC -> "../dirB"
- # |-- dirB/
- # | |-- fileB
- # |-- linkD -> "../dirB"
- # |-- dirC/
- # | |-- fileC
- # | |-- fileD
+ # |-- brokenLink -> non-existing
+ # |-- dirA
+ # | `-- linkC -> ../dirB
+ # |-- dirB
+ # | |-- fileB
+ # | `-- linkD -> ../dirB
+ # |-- dirC
+ # | |-- dirD
+ # | | `-- fileD
+ # | `-- fileC
+ # |-- dirE
# |-- fileA
- # |-- linkA -> "fileA"
- # |-- linkB -> "dirB"
+ # |-- linkA -> fileA
+ # `-- linkB -> dirB
#
def setUp(self):
+ def cleanup():
+ os.chmod(join('dirE'), 0o777)
+ support.rmtree(BASE)
+ self.addCleanup(cleanup)
os.mkdir(BASE)
- self.addCleanup(support.rmtree, BASE)
os.mkdir(join('dirA'))
os.mkdir(join('dirB'))
os.mkdir(join('dirC'))
os.mkdir(join('dirC', 'dirD'))
+ os.mkdir(join('dirE'))
with open(join('fileA'), 'wb') as f:
f.write(b"this is file A\n")
with open(join('dirB', 'fileB'), 'wb') as f:
@@ -1227,6 +1234,7 @@ class _BasePathTest(object):
f.write(b"this is file C\n")
with open(join('dirC', 'dirD', 'fileD'), 'wb') as f:
f.write(b"this is file D\n")
+ os.chmod(join('dirE'), 0)
if not symlink_skip_reason:
# Relative symlinks
os.symlink('fileA', join('linkA'))
@@ -1363,7 +1371,7 @@ class _BasePathTest(object):
p = P(BASE)
it = p.iterdir()
paths = set(it)
- expected = ['dirA', 'dirB', 'dirC', 'fileA']
+ expected = ['dirA', 'dirB', 'dirC', 'dirE', 'fileA']
if not symlink_skip_reason:
expected += ['linkA', 'linkB', 'brokenLink']
self.assertEqual(paths, { P(BASE, q) for q in expected })