if 'cygwin' in syslow or 'windows' in syslow or 'darwin' in syslow:
raise unittest.SkipTest("If your filesystem doesn't support efficient sparse files then it is very expensive (Mac OS X and Windows don't support efficient sparse files).")
- avail = fileutil.get_available_space('.', 512*2**20)
+ avail = fileutil.get_available_space(u".", 512*2**20)
if avail <= 4*2**30:
raise unittest.SkipTest("This test will spuriously fail if you have less than 4 GiB free on your filesystem.")
self.failUnlessReallyEqual(fileutil.windows_expanduser(u"a\\~\\foo"), u"a\\~\\foo")
def test_disk_stats(self):
- avail = fileutil.get_available_space('.', 2**14)
+ avail = fileutil.get_available_space(u".", 2**14)
if avail == 0:
raise unittest.SkipTest("This test will spuriously fail there is no disk space left.")
- disk = fileutil.get_disk_stats('.', 2**13)
+ disk = fileutil.get_disk_stats(u".", 2**13)
self.failUnless(disk['total'] > 0, disk['total'])
# we tolerate used==0 for a Travis-CI bug, see #2290
self.failUnless(disk['used'] >= 0, disk['used'])
def test_disk_stats_avail_nonnegative(self):
# This test will spuriously fail if you have more than 2^128
# bytes of available space on your filesystem.
- disk = fileutil.get_disk_stats('.', 2**128)
+ disk = fileutil.get_disk_stats(u".", 2**128)
self.failUnlessEqual(disk['avail'], 0)
class PollMixinTests(unittest.TestCase):
filesystem as reserved_space.
"""
+ if not isinstance(whichdir, unicode):
+ raise AssertionError("whichdir must be Unicode")
+
if have_GetDiskFreeSpaceExW:
# If this is a Windows system and GetDiskFreeSpaceExW is available, use it.
# (This might put up an error dialog unless
# <http://docs.python.org/library/os.html#os.statvfs>
# <http://opengroup.org/onlinepubs/7990989799/xsh/fstatvfs.html>
# <http://opengroup.org/onlinepubs/7990989799/xsh/sysstatvfs.h.html>
- s = os.statvfs(whichdir)
+
+ from allmydata.util.encodingutil import get_filesystem_encoding
+ s = os.statvfs(whichdir.encode(get_filesystem_encoding()))
# on my mac laptop:
# statvfs(2) is a wrapper around statfs(2).