[pypy-commit] pypy release-2.1.x: skip test_statvfs if statvfs is not available

bivab noreply at buildbot.pypy.org
Thu Jul 25 16:36:24 CEST 2013


Author: David Schneider <david.schneider at picle.org>
Branch: release-2.1.x
Changeset: r65647:06f936c49498
Date: 2013-07-25 15:55 +0200
http://bitbucket.org/pypy/pypy/changeset/06f936c49498/

Log:	skip test_statvfs if statvfs is not available (transplanted from
	e02836bd3823d5c3db5b2dea56fba55f8e15094f)

diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -184,14 +184,15 @@
                     assert isinstance(e, WindowsError)
                     assert e.winerror == 3
 
-    def test_statvfs(self):
-        st = self.posix.statvfs(".")
-        assert isinstance(st, self.posix.statvfs_result)
-        for field in [
-            'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail',
-            'f_files', 'f_ffree', 'f_favail', 'f_flag', 'f_namemax',
-        ]:
-            assert hasattr(st, field)
+    if hasattr(__import__(os.name), "statvfs"):
+        def test_statvfs(self):
+            st = self.posix.statvfs(".")
+            assert isinstance(st, self.posix.statvfs_result)
+            for field in [
+                'f_bsize', 'f_frsize', 'f_blocks', 'f_bfree', 'f_bavail',
+                'f_files', 'f_ffree', 'f_favail', 'f_flag', 'f_namemax',
+            ]:
+                assert hasattr(st, field)
 
     def test_pickle(self):
         import pickle, os


More information about the pypy-commit mailing list