diff options
| author | Gregory P. Smith <greg@krypto.org> | 2011-03-15 18:55:17 (GMT) |
|---|---|---|
| committer | Gregory P. Smith <greg@krypto.org> | 2011-03-15 18:55:17 (GMT) |
| commit | 112bb3ac6abc28d5e982019d667613ab168ad8d1 (patch) | |
| tree | 8d7cae8bab7f7c435b6f6e517560813630fc4d61 /Lib/test/test_subprocess.py | |
| parent | df1d00a1e3d5ec1ee994ab0b002b974f22a6eaa4 (diff) | |
| download | cpython-112bb3ac6abc28d5e982019d667613ab168ad8d1.zip cpython-112bb3ac6abc28d5e982019d667613ab168ad8d1.tar.gz cpython-112bb3ac6abc28d5e982019d667613ab168ad8d1.tar.bz2 | |
Add unittests demonstrating issue #11432.
Diffstat (limited to 'Lib/test/test_subprocess.py')
| -rw-r--r-- | Lib/test/test_subprocess.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 5e6c40f..92b61a9 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -3,6 +3,7 @@ from test import support import subprocess import sys import signal +import io import os import errno import tempfile @@ -1256,6 +1257,24 @@ class POSIXProcessTestCase(BaseTestCase): close_fds=False, pass_fds=(fd, ))) self.assertIn('overriding close_fds', str(context.warning)) + def test_stdout_stdin_are_single_inout_fd(self): + with io.open(os.devnull, "r+") as inout: + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdout=inout, stdin=inout) + p.wait() + + def test_stdout_stderr_are_single_inout_fd(self): + with io.open(os.devnull, "r+") as inout: + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stdout=inout, stderr=inout) + p.wait() + + def test_stderr_stdin_are_single_inout_fd(self): + with io.open(os.devnull, "r+") as inout: + p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"], + stderr=inout, stdin=inout) + p.wait() + def test_wait_when_sigchild_ignored(self): # NOTE: sigchild_ignore.py may not be an effective test on all OSes. sigchild_ignore = support.findfile("sigchild_ignore.py", @@ -1528,19 +1547,6 @@ class ContextManagerTests(ProcessTestCase): raise c.exception -def test_main(): - unit_tests = (ProcessTestCase, - POSIXProcessTestCase, - Win32ProcessTestCase, - ProcessTestCasePOSIXPurePython, - CommandTests, - ProcessTestCaseNoPoll, - HelperFunctionTests, - CommandsWithSpaces, - ContextManagerTests) - - support.run_unittest(*unit_tests) - support.reap_children() - if __name__ == "__main__": - test_main() + unittest.main() + support.reap_children() |
