Description: Skip fsync tests when building with eatmydata
 pypy component forwarded
Author: Stefano Rivera <stefanor@debian.org>
Forwarded: https://bitbucket.org/pypy/pypy/changeset/0eea2bcfa892
Last-Update: 2011-12-21

--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -656,7 +656,11 @@
                 os.fsync(f)     # <- should also work with a file, or anything
             finally:            #    with a fileno() method
                 f.close()
-            raises(OSError, os.fsync, fd)
+            try:
+                # May not raise anything with a buggy libc (or eatmydata)
+                os.fsync(fd)
+            except OSError:
+                pass
             raises(ValueError, os.fsync, -1)
 
     if hasattr(os, 'fdatasync'):
@@ -668,7 +672,11 @@
                 os.fdatasync(fd)
             finally:
                 f.close()
-            raises(OSError, os.fdatasync, fd)
+            try:
+                # May not raise anything with a buggy libc (or eatmydata)
+                os.fdatasync(fd)
+            except OSError:
+                pass
             raises(ValueError, os.fdatasync, -1)
 
     if hasattr(os, 'fchdir'):
--- a/lib-python/2.7/test/test_os.py
+++ b/lib-python/2.7/test/test_os.py
@@ -559,6 +559,8 @@
         except OSError as e:
             self.assertEqual(e.errno, errno.EBADF)
         else:
+            if f.__name__.endswith('sync'):
+                return  # eatmydata won't raise an OSError
             self.fail("%r didn't raise a OSError with a bad file descriptor"
                       % f)
 
