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

Method test_stdout_filedes

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

Source from the content-addressed store, hash-verified

574 self.assertEqual(p.stdout.read(), b"orange")
575
576 def test_stdout_filedes(self):
577 # stdout is set to open file descriptor
578 tf = tempfile.TemporaryFile()
579 self.addCleanup(tf.close)
580 d = tf.fileno()
581 p = subprocess.Popen([sys.executable, "-c",
582 'import sys; sys.stdout.write("orange")'],
583 stdout=d)
584 p.wait()
585 os.lseek(d, 0, 0)
586 self.assertEqual(os.read(d, 1024), b"orange")
587
588 def test_stdout_fileobj(self):
589 # stdout is set to open file object

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected