def test_popen_io_readloop(monkeypatch, execmodel): sio = BytesIO('test'.encode('ascii')) io = Popen2IO(sio, sio, execmodel) real_read = io._read def newread(numbytes): if numbytes > 1: numbytes = numbytes-1 return real_read(numbytes) io._read = newread result = io.read(3) assert result == 'tes'.encode('ascii')
def __init__(self, args, execmodel): self.popen = p = execmodel.PopenPiped(args) Popen2IO.__init__(self, p.stdin, p.stdout, execmodel=execmodel)
def __init__(self, args): self.popen = p = Popen(args, stdin=PIPE, stdout=PIPE) Popen2IO.__init__(self, p.stdin, p.stdout)