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

Method test_stdin_fileobj

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

Source from the content-addressed store, hash-verified

554 self.assertEqual(p.returncode, 1)
555
556 def test_stdin_fileobj(self):
557 # stdin is set to open file object
558 tf = tempfile.TemporaryFile()
559 self.addCleanup(tf.close)
560 tf.write(b"pear")
561 tf.seek(0)
562 p = subprocess.Popen([sys.executable, "-c",
563 'import sys; sys.exit(sys.stdin.read() == "pear")'],
564 stdin=tf)
565 p.wait()
566 self.assertEqual(p.returncode, 1)
567
568 def test_stdout_pipe(self):
569 # stdout redirection

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected