Example #1
0
 def test_os_fdatasync(self):
     fname = str(udir.join('os_test.txt'))
     fd = os.open(fname, os.O_WRONLY|os.O_CREAT, 0777)
     assert fd >= 0
     os.write(fd, 'Hello world')
     rposix.fdatasync(fd)
     fid = open(fname)
     assert fid.read() == 'Hello world'
     os.close(fd)
     py.test.raises(OSError, rposix.fdatasync, fd)
Example #2
0
 def test_os_fdatasync(self):
     fname = str(udir.join('os_test.txt'))
     fd = os.open(fname, os.O_WRONLY | os.O_CREAT, 0777)
     assert fd >= 0
     os.write(fd, 'Hello world')
     rposix.fdatasync(fd)
     fid = open(fname)
     assert fid.read() == 'Hello world'
     os.close(fd)
     py.test.raises(OSError, rposix.fdatasync, fd)