Skip to content

Commit dd75e7f

Browse files
committed
Add win32 condition to tests that will fail outside of Windows
1 parent a96dc09 commit dd75e7f

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

Lib/test/test_ntpath.py

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,30 +1354,31 @@ def test_sameopenfile(self):
13541354
ntpath.sameopenfile(-1, -1)
13551355

13561356
def test_ismount(self):
1357-
self.assertTrue(ntpath.ismount("c:\\"))
1358-
self.assertTrue(ntpath.ismount("C:\\"))
1359-
self.assertTrue(ntpath.ismount("c:/"))
1360-
self.assertTrue(ntpath.ismount("C:/"))
1361-
self.assertTrue(ntpath.ismount("\\\\.\\c:\\"))
1362-
self.assertTrue(ntpath.ismount("\\\\.\\C:\\"))
1363-
1364-
self.assertTrue(ntpath.ismount(b"c:\\"))
1365-
self.assertTrue(ntpath.ismount(b"C:\\"))
1366-
self.assertTrue(ntpath.ismount(b"c:/"))
1367-
self.assertTrue(ntpath.ismount(b"C:/"))
1368-
self.assertTrue(ntpath.ismount(b"\\\\.\\c:\\"))
1369-
self.assertTrue(ntpath.ismount(b"\\\\.\\C:\\"))
1370-
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'")
1357+
if sys.platform == "win32":
1358+
self.assertTrue(ntpath.ismount("c:\\"))
1359+
self.assertTrue(ntpath.ismount("C:\\"))
1360+
self.assertTrue(ntpath.ismount("c:/"))
1361+
self.assertTrue(ntpath.ismount("C:/"))
1362+
self.assertTrue(ntpath.ismount("\\\\.\\c:\\"))
1363+
self.assertTrue(ntpath.ismount("\\\\.\\C:\\"))
1364+
1365+
self.assertTrue(ntpath.ismount(b"c:\\"))
1366+
self.assertTrue(ntpath.ismount(b"C:\\"))
1367+
self.assertTrue(ntpath.ismount(b"c:/"))
1368+
self.assertTrue(ntpath.ismount(b"C:/"))
1369+
self.assertTrue(ntpath.ismount(b"\\\\.\\c:\\"))
1370+
self.assertTrue(ntpath.ismount(b"\\\\.\\C:\\"))
1371+
1372+
# Look for a non-existent drive letter that can be used to test
1373+
# behaviour of ismount().
1374+
for drive in "DEFGHIJKLMNOPQRSTUVWXYZ":
1375+
if not ntpath.exists(drive + ":\\"):
1376+
self.assertFalse(ntpath.ismount(drive + ":\\"))
1377+
self.assertFalse(ntpath.ismount(drive + ":\\NotExist"))
1378+
break
1379+
else:
1380+
if support.verbose:
1381+
print("No missing drive found to test 'ismount'")
13811382

13821383
with os_helper.temp_dir() as d:
13831384
self.assertFalse(ntpath.ismount(d))

0 commit comments

Comments
 (0)