(self)
| 1000 | self.assertIsNone(stderr) |
| 1001 | |
| 1002 | def test_communicate_timeout(self): |
| 1003 | p = subprocess.Popen([sys.executable, "-c", |
| 1004 | 'import sys,os,time;' |
| 1005 | 'sys.stderr.write("pineapple\\n");' |
| 1006 | 'time.sleep(1);' |
| 1007 | 'sys.stderr.write("pear\\n");' |
| 1008 | 'sys.stdout.write(sys.stdin.read())'], |
| 1009 | universal_newlines=True, |
| 1010 | stdin=subprocess.PIPE, |
| 1011 | stdout=subprocess.PIPE, |
| 1012 | stderr=subprocess.PIPE) |
| 1013 | self.assertRaises(subprocess.TimeoutExpired, p.communicate, "banana", |
| 1014 | timeout=0.3) |
| 1015 | # Make sure we can keep waiting for it, and that we get the whole output |
| 1016 | # after it completes. |
| 1017 | (stdout, stderr) = p.communicate() |
| 1018 | self.assertEqual(stdout, "banana") |
| 1019 | self.assertEqual(stderr.encode(), b"pineapple\npear\n") |
| 1020 | |
| 1021 | def test_communicate_timeout_large_output(self): |
| 1022 | # Test an expiring timeout while the child is outputting lots of data. |
nothing calls this directly
no test coverage detected