# (see https://bitbucket.org/pitrou/pathlib/issue/12/)
return False
+ def is_mount(self):
+ """
+ Check if this path is a POSIX mount point
+ """
+ # Need to exist and be a dir
+ if not self.exists() or not self.is_dir():
+ return False
+
+ parent = Path(self.parent)
+ try:
+ parent_dev = parent.stat().st_dev
+ except OSError:
+ return False
+
+ dev = self.stat().st_dev
+ if dev != parent_dev:
+ return True
+ ino = self.stat().st_ino
+ parent_ino = parent.stat().st_ino
+ return ino == parent_ino
+
def is_symlink(self):
"""
Whether this path is a symbolic link.
def group(self):
raise NotImplementedError("Path.group() is unsupported on this system")
+
+ def is_mount(self):
+ raise NotImplementedError("Path.is_mount() is unsupported on this system")
self.assertFalse((P / 'linkB').is_file())
self.assertFalse((P/ 'brokenLink').is_file())
+ @only_posix
+ def test_is_mount(self):
+ P = self.cls(BASE)
+ R = self.cls('/') # TODO: Work out windows
+ self.assertFalse((P / 'fileA').is_mount())
+ self.assertFalse((P / 'dirA').is_mount())
+ self.assertFalse((P / 'non-existing').is_mount())
+ self.assertFalse((P / 'fileA' / 'bah').is_mount())
+ self.assertTrue(R.is_mount())
+ if support.can_symlink():
+ self.assertFalse((P / 'linkA').is_mount())
+
def test_is_symlink(self):
P = self.cls(BASE)
self.assertFalse((P / 'fileA').is_symlink())