summaryrefslogtreecommitdiff
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2016-01-06 09:42:07 -0800
committerGuido van Rossum <guido@python.org>2016-01-06 09:42:07 -0800
commit6c2d33a258bb62bc74be4d848968c99c6fbfbba4 (patch)
tree13015bfdc7364308ecca55890323d23f203ceec0 /Lib/test/test_pathlib.py
parent114a1d638ecd9dc78cf6514c49e5b46213d3a5cd (diff)
downloadcpython-git-6c2d33a258bb62bc74be4d848968c99c6fbfbba4.tar.gz
Issue #24120: Ignore PermissionError in pathlib.Path.[r]glob(). Ulrich Petri.
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 11420e2c17..d272264595 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1203,26 +1203,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:
@@ -1231,6 +1238,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'))
@@ -1306,7 +1314,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 })