Issue #12442: add shutil.disk_usage()

This commit is contained in:
Giampaolo Rodola' 2011-07-01 13:55:36 +02:00
parent 59929d9877
commit 210e7ca032
6 changed files with 77 additions and 1 deletions

View file

@ -728,6 +728,16 @@ class TestShutil(unittest.TestCase):
unregister_unpack_format('Boo2')
self.assertEqual(get_unpack_formats(), formats)
@unittest.skipUnless(hasattr(shutil, 'disk_usage'),
"disk_usage not available on this platform")
def test_disk_usage(self):
usage = shutil.disk_usage(os.getcwd())
self.assertTrue(usage.total > 0)
self.assertTrue(usage.used > 0)
self.assertTrue(usage.free >= 0)
self.assertTrue(usage.total >= usage.used)
self.assertTrue(usage.total > usage.free)
class TestMove(unittest.TestCase):