def isAvailable(self, required): """Check availability of space for storing a resource without using reserved space. """ if not self._writable: return False stat = statvfs(self.mountPoint) available = stat.f_frsize * stat.f_bavail - required # total = stat.f_frsize * stat.f_blocks free_space = available * 100.0 / (stat.f_frsize * stat.f_blocks) return free_space >= self.reserved
def test_statvfs(self): if hasattr(posix, 'statvfs'): self.assert_(posix.statvfs(os.curdir))