diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-03-24 19:46:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-24 19:46:25 (GMT) |
commit | 8c8785b2f8e4048cef350f89c686266f4519b67c (patch) | |
tree | 3e66a194a07986efb4cf5d946415a2b02b6ec5c3 /Lib/test | |
parent | cc3331fec8b7a61c3f06c097eac85bfa38490758 (diff) | |
download | cpython-8c8785b2f8e4048cef350f89c686266f4519b67c.zip cpython-8c8785b2f8e4048cef350f89c686266f4519b67c.tar.gz cpython-8c8785b2f8e4048cef350f89c686266f4519b67c.tar.bz2 |
bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True)… (#806)
when the OS gives priority to errors such as EACCES over EEXIST.
(cherry picked from commit af7b9ec5c855366feef4c67dc492d64b3baf84ca)
Diffstat (limited to 'Lib/test')
-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 88a93e5..3ff9726 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1776,6 +1776,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': |