def test_os_write(self): #Same as test in rpython/test/test_rbuiltin fname = str(udir.join('os_test.txt')) fd = os.open(fname, os.O_WRONLY|os.O_CREAT, 0777) assert fd >= 0 rposix.write(fd, 'Hello world') os.close(fd) with open(fname) as fid: assert fid.read() == "Hello world" fd = os.open(fname, os.O_WRONLY|os.O_CREAT, 0777) os.close(fd) py.test.raises(OSError, rposix.write, fd, 'Hello world')
def test_os_write(self): #Same as test in rpython/test/test_rbuiltin fname = str(udir.join('os_test.txt')) fd = os.open(fname, os.O_WRONLY | os.O_CREAT, 0777) assert fd >= 0 rposix.write(fd, 'Hello world') os.close(fd) with open(fname) as fid: assert fid.read() == "Hello world" fd = os.open(fname, os.O_WRONLY | os.O_CREAT, 0777) os.close(fd) py.test.raises(OSError, rposix.write, fd, 'Hello world')