Lines Matching refs:self

56     def __init__(self, args, stdin=None, stdout=PIPE_PTY, stderr=PIPE_PTY,  argument
83 super(Popen, self).__init__(args, stdin=stdin,
95 self.stdout = os.fdopen(stdout_pty[0])
97 self.stderr = os.fdopen(stderr_pty[0])
103 def CommunicateFilter(self, output): argument
149 if self.stdin:
152 self.stdin.flush()
154 write_set.append(self.stdin)
156 self.stdin.close()
157 if self.stdout:
158 read_set.append(self.stdout)
160 if self.stderr and self.stderr != self.stdout:
161 read_set.append(self.stderr)
175 self.terminate()
177 if self.stdin in wlist:
182 bytes_written = os.write(self.stdin.fileno(), chunk)
185 self.stdin.close()
186 write_set.remove(self.stdin)
188 if self.stdout in rlist:
192 data = os.read(self.stdout.fileno(), 1024)
196 self.stdout.close()
197 read_set.remove(self.stdout)
203 if self.stderr in rlist:
207 data = os.read(self.stderr.fileno(), 1024)
211 self.stderr.close()
212 read_set.remove(self.stderr)
234 if self.universal_newlines and hasattr(file, 'newlines'):
236 stdout = self._translate_newlines(stdout)
238 stderr = self._translate_newlines(stderr)
240 self.wait()
254 def __init__(self, input_to_send=None): argument
261 self.stdout_data = ''
262 self.stderr_data = ''
263 self.combined_data = ''
264 self.stdin_pipe = None
265 self._input_to_send = input_to_send
268 self.stdin_read_pipe = pipe[0]
269 self._stdin_write_pipe = os.fdopen(pipe[1], 'w')
271 def Output(self, stream, data): argument
274 self.stdout_data += data
276 self.stderr_data += data
277 self.combined_data += data
280 if self._input_to_send:
281 self._stdin_write_pipe.write(self._input_to_send + '\r\n')
282 self._stdin_write_pipe.flush()
284 def _BasicCheck(self, plist, oper): argument
286 self.assertEqual(plist[0], oper.stdout_data)
287 self.assertEqual(plist[1], oper.stderr_data)
288 self.assertEqual(plist[2], oper.combined_data)
291 self.assertEqual(len(plist[0]) + len(plist[1]), len(plist[2]))
293 def test_simple(self): argument
297 self._BasicCheck(plist, oper)
299 def test_stderr(self): argument
304 self._BasicCheck(plist, oper)
305 self.assertEqual(plist [0], 'bad\r\n')
306 self.assertEqual(plist [1], 'fred\r\n')
308 def test_shell(self): argument
312 self.assertRaises(OSError, Popen, [cmd], shell=False)
314 self._BasicCheck(plist, oper)
315 self.assertEqual(len(plist [0]), 0)
316 self.assertEqual(plist [1], 'test\r\n')
318 def test_list_args(self): argument
323 self._BasicCheck(plist, oper)
324 self.assertEqual(plist [0], ' '.join(cmd[1:]) + '\r\n')
325 self.assertEqual(len(plist [1]), 0)
332 self._BasicCheck(plist, oper)
333 self.assertEqual(plist [0], '\r\n')
335 def test_cwd(self): argument
340 self._BasicCheck(plist, oper)
341 self.assertEqual(plist [0], '/tmp\r\n')
343 def test_env(self): argument
352 self._BasicCheck(plist, oper)
353 self.assertEqual(plist [0], add and 'fred\r\n' or '\r\n')
355 def test_extra_args(self): argument
357 self.assertRaises(ValueError, Popen, 'true', close_fds=False)
359 def test_basic_input(self): argument
371 self._BasicCheck(plist, oper)
372 self.assertEqual(len(plist [1]), 0)
373 self.assertEqual(plist [0], prompt + 'Hello Flash\r\r\n')
375 def test_isatty(self): argument
384 self._BasicCheck(plist, oper)
385 self.assertEqual(plist [0], 'terminal 1\r\n')
386 self.assertEqual(plist [1], 'terminal 2\r\n')
392 self._BasicCheck(plist, oper)
393 self.assertEqual(plist [0], 'not 1\n')
394 self.assertEqual(plist [1], 'not 2\n')