summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-24 19:46:46 (GMT)
committerGitHub <noreply@github.com>2017-03-24 19:46:46 (GMT)
commit1fc1f8d7f737f80a1ee5ea37b9781c0a790102b2 (patch)
tree1462ff3b86c04f43c51c8fb4c777db77373f41c4 /Lib/test/test_pathlib.py
parent80cb6ed4db9bae09de1e9ad6001d11cb45a4c1cc (diff)
downloadcpython-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.py5
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':