mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #9035: os.path.ismount now recognises volumes mounted below
a drive root on Windows. Original patch by Atsuo Ishimoto.
This commit is contained in:
parent
536ffe161c
commit
6b528067c5
4 changed files with 103 additions and 5 deletions
|
@ -256,6 +256,40 @@ class TestNtpath(unittest.TestCase):
|
|||
# dialogs (#4804)
|
||||
ntpath.sameopenfile(-1, -1)
|
||||
|
||||
def test_ismount(self):
|
||||
self.assertTrue(ntpath.ismount("c:\\"))
|
||||
self.assertTrue(ntpath.ismount("C:\\"))
|
||||
self.assertTrue(ntpath.ismount("c:/"))
|
||||
self.assertTrue(ntpath.ismount("C:/"))
|
||||
self.assertTrue(ntpath.ismount("\\\\.\\c:\\"))
|
||||
self.assertTrue(ntpath.ismount("\\\\.\\C:\\"))
|
||||
|
||||
self.assertTrue(ntpath.ismount(b"c:\\"))
|
||||
self.assertTrue(ntpath.ismount(b"C:\\"))
|
||||
self.assertTrue(ntpath.ismount(b"c:/"))
|
||||
self.assertTrue(ntpath.ismount(b"C:/"))
|
||||
self.assertTrue(ntpath.ismount(b"\\\\.\\c:\\"))
|
||||
self.assertTrue(ntpath.ismount(b"\\\\.\\C:\\"))
|
||||
|
||||
with support.temp_dir() as d:
|
||||
self.assertFalse(ntpath.ismount(d))
|
||||
|
||||
#
|
||||
# Make sure the current folder isn't the root folder
|
||||
# (or any other volume root). The drive-relative
|
||||
# locations below cannot then refer to mount points
|
||||
#
|
||||
drive, path = ntpath.splitdrive(sys.executable)
|
||||
with support.change_cwd(os.path.dirname(sys.executable)):
|
||||
self.assertFalse(ntpath.ismount(drive.lower()))
|
||||
self.assertFalse(ntpath.ismount(drive.upper()))
|
||||
|
||||
self.assertTrue(ntpath.ismount("\\\\localhost\\c$"))
|
||||
self.assertTrue(ntpath.ismount("\\\\localhost\\c$\\"))
|
||||
|
||||
self.assertTrue(ntpath.ismount(b"\\\\localhost\\c$"))
|
||||
self.assertTrue(ntpath.ismount(b"\\\\localhost\\c$\\"))
|
||||
|
||||
|
||||
class NtCommonTest(test_genericpath.CommonTest, unittest.TestCase):
|
||||
pathmodule = ntpath
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue