Beispiel #1
0
 def test_os_fsync(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.fsync(fd)
     os.close(fd)
     fid = open(fname)
     assert fid.read() == 'Hello world'
     fid.close()
     py.test.raises(OSError, rposix.fsync, fd)
Beispiel #2
0
 def test_os_fsync(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.fsync(fd)
     os.close(fd)
     fid = open(fname)
     assert fid.read() == 'Hello world'
     fid.close()
     py.test.raises(OSError, rposix.fsync, fd)