summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 22:54:56 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 22:54:56 (GMT)
commitd3c4853b7869b347462343fd9df99f998e0eb018 (patch)
treea57a8027f52185ab3abf65040e694306e3668163 /Lib/test/test_pathlib.py
parent7e10dbbd45503268f7bb3b241e30745df6c91b99 (diff)
downloadcpython-d3c4853b7869b347462343fd9df99f998e0eb018.zip
cpython-d3c4853b7869b347462343fd9df99f998e0eb018.tar.gz
cpython-d3c4853b7869b347462343fd9df99f998e0eb018.tar.bz2
Issue #29416: Prevent infinite loop in pathlib.Path.mkdir
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r--Lib/test/test_pathlib.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index fa96d9f..28e3ea4 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1727,6 +1727,17 @@ class _BasePathTest(object):
self.assertTrue(p.exists())
self.assertEqual(p.stat().st_ctime, st_ctime_first)
+ @only_nt # XXX: not sure how to test this on POSIX
+ def test_mkdir_with_unknown_drive(self):
+ for d in 'ZYXWVUTSRQPONMLKJIHGFEDCBA':
+ p = self.cls(d + ':\\')
+ if not p.is_dir():
+ break
+ else:
+ self.skipTest("cannot find a drive that doesn't exist")
+ with self.assertRaises(OSError):
+ (p / 'child' / 'path').mkdir(parents=True)
+
def test_mkdir_with_child_file(self):
p = self.cls(BASE, 'dirB', 'fileB')
self.assertTrue(p.exists())