當前位置: 首頁>>代碼示例>>Python>>正文


Python posixpath.ismount方法代碼示例

本文整理匯總了Python中posixpath.ismount方法的典型用法代碼示例。如果您正苦於以下問題:Python posixpath.ismount方法的具體用法?Python posixpath.ismount怎麽用?Python posixpath.ismount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在posixpath的用法示例。


在下文中一共展示了posixpath.ismount方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ismount_different_device

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount_different_device(self):
        # Simulate the path being on a different device from its parent by
        # mocking out st_dev.
        save_lstat = os.lstat
        def fake_lstat(path):
            st_ino = 0
            st_dev = 0
            if path == ABSTFN:
                st_dev = 1
                st_ino = 1
            return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
        try:
            os.lstat = fake_lstat
            self.assertIs(posixpath.ismount(ABSTFN), True)
        finally:
            os.lstat = save_lstat 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:18,代碼來源:test_posixpath.py

示例2: test_ismount_directory_not_readable

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount_directory_not_readable(self):
        # issue #2466: Simulate ismount run on a directory that is not
        # readable, which used to return False.
        save_lstat = os.lstat
        def fake_lstat(path):
            st_ino = 0
            st_dev = 0
            if path.startswith(ABSTFN) and path != ABSTFN:
                # ismount tries to read something inside the ABSTFN directory;
                # simulate this being forbidden (no read permission).
                raise OSError("Fake [Errno 13] Permission denied")
            if path == ABSTFN:
                st_dev = 1
                st_ino = 1
            return posix.stat_result((0, st_ino, st_dev, 0, 0, 0, 0, 0, 0, 0))
        try:
            os.lstat = fake_lstat
            self.assertIs(posixpath.ismount(ABSTFN), True)
        finally:
            os.lstat = save_lstat 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:22,代碼來源:test_posixpath.py

示例3: test_ismount

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:4,代碼來源:test_posixpath.py

示例4: test_ismount_non_existent

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount_non_existent(self):
        # Non-existent mountpoint.
        self.assertIs(posixpath.ismount(ABSTFN), False)
        try:
            os.mkdir(ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            safe_rmdir(ABSTFN) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:10,代碼來源:test_posixpath.py

示例5: test_ismount_symlinks

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount_symlinks(self):
        # Symlinks are never mountpoints.
        try:
            os.symlink("/", ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            os.unlink(ABSTFN) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:9,代碼來源:test_posixpath.py

示例6: test_ismount

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            self.assertIs(posixpath.ismount(b"/"), True) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:7,代碼來源:test_posixpath.py

示例7: assert_s3ql_mountpoint

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def assert_s3ql_mountpoint(mountpoint):
    '''Raise QuietError if *mountpoint* is not an S3QL mountpoint

    Implicitly calls `assert_s3ql_fs` first. Returns name of the
    S3QL control file.
    '''

    ctrlfile = assert_s3ql_fs(mountpoint)
    if not posixpath.ismount(mountpoint):
        raise QuietError('%s is not a mount point' % mountpoint)

    return ctrlfile 
開發者ID:s3ql,項目名稱:s3ql,代碼行數:14,代碼來源:common.py

示例8: test_ismount

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount(self):
            self.assertIs(posixpath.ismount("/"), True)

            self.assertRaises(TypeError, posixpath.ismount) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:6,代碼來源:test_posixpath.py

示例9: test_ismount

# 需要導入模塊: import posixpath [as 別名]
# 或者: from posixpath import ismount [as 別名]
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)
        self.assertIs(posixpath.ismount(b"/"), True) 
開發者ID:bkerler,項目名稱:android_universal,代碼行數:5,代碼來源:test_posixpath.py


注:本文中的posixpath.ismount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。