Python posixpath.ismount() Examples

The following are 30 code examples of posixpath.ismount(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module posixpath , or try the search function .
Example #1
Source File: test_posixpath.py    From android_universal with MIT License 6 votes vote down vote up
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 
Example #2
Source File: test_posixpath.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
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 
Example #3
Source File: test_posixpath.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
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 
Example #4
Source File: test_posixpath.py    From android_universal with MIT License 6 votes vote down vote up
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 
Example #5
Source File: test_posixpath.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #6
Source File: test_posixpath.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
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 
Example #7
Source File: test_posixpath.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #8
Source File: test_posixpath.py    From Fluid-Designer with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #9
Source File: test_posixpath.py    From android_universal with MIT License 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)
        self.assertIs(posixpath.ismount(b"/"), True) 
Example #10
Source File: test_posixpath.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_ismount_symlinks(self):
        # Symlinks are never mountpoints.
        try:
            os.symlink("/", ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            os.unlink(ABSTFN) 
Example #11
Source File: common.py    From s3ql with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #12
Source File: test_posixpath.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_ismount(self):
            self.assertIs(posixpath.ismount("/"), True)

            self.assertRaises(TypeError, posixpath.ismount) 
Example #13
Source File: test_posixpath.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
Example #14
Source File: test_posixpath.py    From gcblue with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
Example #15
Source File: test_posixpath.py    From android_universal with MIT License 5 votes vote down vote up
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) 
Example #16
Source File: test_posixpath.py    From android_universal with MIT License 5 votes vote down vote up
def test_ismount_symlinks(self):
        # Symlinks are never mountpoints.
        try:
            os.symlink("/", ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            os.unlink(ABSTFN) 
Example #17
Source File: test_posixpath.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
Example #18
Source File: test_posixpath.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #19
Source File: test_posixpath.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            self.assertIs(posixpath.ismount(b"/"), True) 
Example #20
Source File: test_posixpath.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
Example #21
Source File: test_posixpath.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_ismount_symlinks(self):
        # Symlinks are never mountpoints.
        try:
            os.symlink("/", ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            os.unlink(ABSTFN) 
Example #22
Source File: test_posixpath.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
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) 
Example #23
Source File: test_posixpath.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            self.assertIs(posixpath.ismount(b"/"), True) 
Example #24
Source File: test_posixpath.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_ismount_symlinks(self):
        # Symlinks are never mountpoints.
        try:
            os.symlink("/", ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            os.unlink(ABSTFN) 
Example #25
Source File: test_posixpath.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
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) 
Example #26
Source File: test_posixpath.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", DeprecationWarning)
            self.assertIs(posixpath.ismount(b"/"), True) 
Example #27
Source File: test_posixpath.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
Example #28
Source File: test_posixpath.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_ismount(self):
        self.assertIs(posixpath.ismount("/"), True) 
Example #29
Source File: test_posixpath.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_ismount_symlinks(self):
        # Symlinks are never mountpoints.
        try:
            os.symlink("/", ABSTFN)
            self.assertIs(posixpath.ismount(ABSTFN), False)
        finally:
            os.unlink(ABSTFN) 
Example #30
Source File: test_posixpath.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
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)