コード例 #1
0
ファイル: test_rposix.py プロジェクト: abhinavthomas/pypy
 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')
コード例 #2
0
 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')