summaryrefslogtreecommitdiff
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-03-24 20:51:53 +0200
committerGitHub <noreply@github.com>2017-03-24 20:51:53 +0200
commitaf7b9ec5c855366feef4c67dc492d64b3baf84ca (patch)
tree48f0d7ad1aad75910e0a9f87876b5d9144fb55b5 /Lib/test/test_pathlib.py
parent8988945cdc27ffa86ba8c624e095b51c459f5154 (diff)
downloadcpython-git-af7b9ec5c855366feef4c67dc492d64b3baf84ca.tar.gz
bpo-25803: Avoid incorrect errors raised by Path.mkdir(exist_ok=True) (#805)
when the OS gives priority to errors such as EACCES over EEXIST.
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 88a93e5802..3ff9726d43 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':