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

Method test_stdin_filedes

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

Source from the content-addressed store, hash-verified

541 self.assertEqual(p.returncode, 1)
542
543 def test_stdin_filedes(self):
544 # stdin is set to open file descriptor
545 tf = tempfile.TemporaryFile()
546 self.addCleanup(tf.close)
547 d = tf.fileno()
548 os.write(d, b"pear")
549 os.lseek(d, 0, 0)
550 p = subprocess.Popen([sys.executable, "-c",
551 'import sys; sys.exit(sys.stdin.read() == "pear")'],
552 stdin=d)
553 p.wait()
554 self.assertEqual(p.returncode, 1)
555
556 def test_stdin_fileobj(self):
557 # stdin is set to open file object

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected