| OLD | NEW |
| 1 import unittest | 1 import unittest |
| 2 from test import support | 2 from test import support |
| 3 import subprocess | 3 import subprocess |
| 4 import sys | 4 import sys |
| 5 import signal | 5 import signal |
| 6 import io | 6 import io |
| 7 import os | 7 import os |
| 8 import errno | 8 import errno |
| 9 import tempfile | 9 import tempfile |
| 10 import time | 10 import time |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 stderr=subprocess.PIPE) as proc: | 1583 stderr=subprocess.PIPE) as proc: |
| 1584 self.assertEqual(proc.stdout.read(), b"stdout") | 1584 self.assertEqual(proc.stdout.read(), b"stdout") |
| 1585 self.assertStderrEqual(proc.stderr.read(), b"stderr") | 1585 self.assertStderrEqual(proc.stderr.read(), b"stderr") |
| 1586 | 1586 |
| 1587 self.assertTrue(proc.stdout.closed) | 1587 self.assertTrue(proc.stdout.closed) |
| 1588 self.assertTrue(proc.stderr.closed) | 1588 self.assertTrue(proc.stderr.closed) |
| 1589 | 1589 |
| 1590 def test_returncode(self): | 1590 def test_returncode(self): |
| 1591 with subprocess.Popen([sys.executable, "-c", | 1591 with subprocess.Popen([sys.executable, "-c", |
| 1592 "import sys; sys.exit(100)"]) as proc: | 1592 "import sys; sys.exit(100)"]) as proc: |
| 1593 proc.wait() | 1593 pass |
| 1594 # __exit__ calls wait(), so the returncode should be set |
| 1594 self.assertEqual(proc.returncode, 100) | 1595 self.assertEqual(proc.returncode, 100) |
| 1595 | 1596 |
| 1596 def test_communicate_stdin(self): | 1597 def test_communicate_stdin(self): |
| 1597 with subprocess.Popen([sys.executable, "-c", | 1598 with subprocess.Popen([sys.executable, "-c", |
| 1598 "import sys;" | 1599 "import sys;" |
| 1599 "sys.exit(sys.stdin.read() == 'context')"], | 1600 "sys.exit(sys.stdin.read() == 'context')"], |
| 1600 stdin=subprocess.PIPE) as proc: | 1601 stdin=subprocess.PIPE) as proc: |
| 1601 proc.communicate(b"context") | 1602 proc.communicate(b"context") |
| 1602 self.assertEqual(proc.returncode, 1) | 1603 self.assertEqual(proc.returncode, 1) |
| 1603 | 1604 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1621 ProcessTestCaseNoPoll, | 1622 ProcessTestCaseNoPoll, |
| 1622 HelperFunctionTests, | 1623 HelperFunctionTests, |
| 1623 CommandsWithSpaces, | 1624 CommandsWithSpaces, |
| 1624 ContextManagerTests) | 1625 ContextManagerTests) |
| 1625 | 1626 |
| 1626 support.run_unittest(*unit_tests) | 1627 support.run_unittest(*unit_tests) |
| 1627 support.reap_children() | 1628 support.reap_children() |
| 1628 | 1629 |
| 1629 if __name__ == "__main__": | 1630 if __name__ == "__main__": |
| 1630 unittest.main() | 1631 unittest.main() |
| OLD | NEW |