[Python-checkins] r63339 - python/trunk/Lib/test/test_os.py

brett.cannon python-checkins at python.org
Fri May 16 02:37:42 CEST 2008


Author: brett.cannon
Date: Fri May 16 02:37:42 2008
New Revision: 63339

Log:
Remove the last usage of statvfs in the stdlib.


Modified:
   python/trunk/Lib/test/test_os.py

Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py	(original)
+++ python/trunk/Lib/test/test_os.py	Fri May 16 02:37:42 2008
@@ -220,7 +220,6 @@
         if not hasattr(os, "statvfs"):
             return
 
-        import statvfs
         try:
             result = os.statvfs(self.fname)
         except OSError, e:
@@ -230,16 +229,13 @@
                 return
 
         # Make sure direct access works
-        self.assertEquals(result.f_bfree, result[statvfs.F_BFREE])
+        self.assertEquals(result.f_bfree, result[3])
 
-        # Make sure all the attributes are there
-        members = dir(result)
-        for name in dir(statvfs):
-            if name[:2] == 'F_':
-                attr = name.lower()
-                self.assertEquals(getattr(result, attr),
-                                  result[getattr(statvfs, name)])
-                self.assert_(attr in members)
+        # Make sure all the attributes are there.
+        members = ('bsize', 'frsize', 'blocks', 'bfree', 'bavail', 'files',
+                    'ffree', 'favail', 'flag', 'namemax')
+        for value, member in enumerate(members):
+            self.assertEquals(getattr(result, 'f_' + member), result[value])
 
         # Make sure that assignment really fails
         try:


More information about the Python-checkins mailing list