MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_stdout_stderr_file

Method test_stdout_stderr_file

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

Source from the content-addressed store, hash-verified

661 self.assertEqual(p.stdout.read(), b"appleorange")
662
663 def test_stdout_stderr_file(self):
664 # capture stdout and stderr to the same open file
665 tf = tempfile.TemporaryFile()
666 self.addCleanup(tf.close)
667 p = subprocess.Popen([sys.executable, "-c",
668 'import sys;'
669 'sys.stdout.write("apple");'
670 'sys.stdout.flush();'
671 'sys.stderr.write("orange")'],
672 stdout=tf,
673 stderr=tf)
674 p.wait()
675 tf.seek(0)
676 self.assertEqual(tf.read(), b"appleorange")
677
678 def test_stdout_filedes_of_stdout(self):
679 # stdout is set to 1 (#1531862).

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