Skip to content

Commit 7b7e9f6

Browse files
committed
Add test for non-existent drive and non-existent path on non-existent drive
1 parent 6e40c62 commit 7b7e9f6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Lib/test/test_ntpath.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,17 @@ def test_ismount(self):
13681368
self.assertTrue(ntpath.ismount(b"\\\\.\\c:\\"))
13691369
self.assertTrue(ntpath.ismount(b"\\\\.\\C:\\"))
13701370

1371+
# Look for a non-existent drive letter that can be used to test
1372+
# behaviour of ismount().
1373+
for drive in "DEFGHIJKLMNOPQRSTUVWXYZ":
1374+
if not ntpath.exists(drive + ":\\"):
1375+
self.assertFalse(ntpath.ismount(drive + ":\\"))
1376+
self.assertFalse(ntpath.ismount(drive + ":\\NotExist"))
1377+
break
1378+
else:
1379+
if support.verbose:
1380+
print("No missing drive found to test 'ismount'")
1381+
13711382
with os_helper.temp_dir() as d:
13721383
self.assertFalse(ntpath.ismount(d))
13731384

0 commit comments

Comments
 (0)