diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-24 19:46:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-24 19:46:46 (GMT) |
commit | 1fc1f8d7f737f80a1ee5ea37b9781c0a790102b2 (patch) | |
tree | 1462ff3b86c04f43c51c8fb4c777db77373f41c4 /Lib/test/test_pathlib.py | |
parent | 80cb6ed4db9bae09de1e9ad6001d11cb45a4c1cc (diff) | |
download | cpython-1fc1f8d7f737f80a1ee5ea37b9781c0a790102b2.zip cpython-1fc1f8d7f737f80a1ee5ea37b9781c0a790102b2.tar.gz cpython-1fc1f8d7f737f80a1ee5ea37b9781c0a790102b2.tar.bz2 |
bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) (#805) (#807)
when the OS gives priority to errors such as EACCES over EEXIST.
(cherry picked from commit af7b9ec5c855366feef4c67dc492d64b3baf84ca)
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 28e3ea4..86d3077 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1727,6 +1727,11 @@ class _BasePathTest(object): self.assertTrue(p.exists()) self.assertEqual(p.stat().st_ctime, st_ctime_first) + def test_mkdir_exist_ok_root(self): + # Issue #25803: A drive root could raise PermissionError on Windows + self.cls('/').resolve().mkdir(exist_ok=True) + self.cls('/').resolve().mkdir(parents=True, exist_ok=True) + @only_nt # XXX: not sure how to test this on POSIX def test_mkdir_with_unknown_drive(self): for d in 'ZYXWVUTSRQPONMLKJIHGFEDCBA': |