MCPcopy Index your code
hub / github.com/python/cpython / test_stdout_fileobj

Method test_stdout_fileobj

Lib/test/test_subprocess.py:588–597  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

586 self.assertEqual(os.read(d, 1024), b"orange")
587
588 def test_stdout_fileobj(self):
589 # stdout is set to open file object
590 tf = tempfile.TemporaryFile()
591 self.addCleanup(tf.close)
592 p = subprocess.Popen([sys.executable, "-c",
593 'import sys; sys.stdout.write("orange")'],
594 stdout=tf)
595 p.wait()
596 tf.seek(0)
597 self.assertEqual(tf.read(), b"orange")
598
599 def test_stderr_pipe(self):
600 # stderr redirection

Callers

nothing calls this directly

Calls 5

waitMethod · 0.95
addCleanupMethod · 0.80
seekMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected