diff options
| author | Guido van Rossum <guido@dropbox.com> | 2016-01-06 17:53:51 (GMT) |
|---|---|---|
| committer | Guido van Rossum <guido@dropbox.com> | 2016-01-06 17:53:51 (GMT) |
| commit | 080169c494e3a7e252d9b43947cbd2576e1a071f (patch) | |
| tree | 65d45f6ec3e2ef722a37f53d5f9b4db17c91a47d /Lib/test/test_pathlib.py | |
| parent | 576f132b986b5ee60e4b84d34a519a5edcd8c03e (diff) | |
| parent | d54377d2cabe6a2057468136ba1f29f48d1b47b7 (diff) | |
| download | cpython-080169c494e3a7e252d9b43947cbd2576e1a071f.zip cpython-080169c494e3a7e252d9b43947cbd2576e1a071f.tar.gz cpython-080169c494e3a7e252d9b43947cbd2576e1a071f.tar.bz2 | |
Issue #24120: Ignore PermissionError in pathlib.Path.[r]glob(). Ulrich Petri. (Merge 3.5->3.6)
Diffstat (limited to 'Lib/test/test_pathlib.py')
| -rw-r--r-- | Lib/test/test_pathlib.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 80cb97e..167a474 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 }) |
