From e1ac7d87afad9c07ec25e5705bb135b71347b581 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Sat, 4 Feb 2017 14:54:56 -0800 Subject: Issue #29416: Prevent infinite loop in pathlib.Path.mkdir --- Lib/test/test_pathlib.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Lib/test/test_pathlib.py') diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index fa96d9f882..28e3ea4da6 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()) -- cgit v1.2.1