(self)
| 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). |
nothing calls this directly
no test coverage detected