MCPcopy
hub / github.com/tornadoweb/tornado / test_subprocess

Method test_subprocess

tornado/test/process_test.py:142–160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

140
141 @gen_test
142 def test_subprocess(self):
143 subproc = Subprocess(
144 [sys.executable, "-u", "-i", "-I"],
145 stdin=Subprocess.STREAM,
146 stdout=Subprocess.STREAM,
147 stderr=subprocess.STDOUT,
148 )
149 self.addCleanup(lambda: self.term_and_wait(subproc))
150 self.addCleanup(subproc.stdout.close)
151 self.addCleanup(subproc.stdin.close)
152 yield subproc.stdout.read_until(b">>> ")
153 subproc.stdin.write(b"print('hello')\n")
154 data = yield subproc.stdout.read_until(b"\n")
155 self.assertEqual(data, b"hello\n")
156
157 yield subproc.stdout.read_until(b">>> ")
158 subproc.stdin.write(b"raise SystemExit\n")
159 data = yield subproc.stdout.read_until_close()
160 self.assertEqual(data, b"")
161
162 @gen_test
163 def test_close_stdin(self):

Callers

nothing calls this directly

Calls 5

term_and_waitMethod · 0.95
SubprocessClass · 0.90
read_untilMethod · 0.80
read_until_closeMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected