Commit 112bb3ac authored by Gregory P. Smith's avatar Gregory P. Smith

Add unittests demonstrating issue #11432.

parent df1d00a1
...@@ -3,6 +3,7 @@ from test import support ...@@ -3,6 +3,7 @@ from test import support
import subprocess import subprocess
import sys import sys
import signal import signal
import io
import os import os
import errno import errno
import tempfile import tempfile
...@@ -1256,6 +1257,24 @@ class POSIXProcessTestCase(BaseTestCase): ...@@ -1256,6 +1257,24 @@ class POSIXProcessTestCase(BaseTestCase):
close_fds=False, pass_fds=(fd, ))) close_fds=False, pass_fds=(fd, )))
self.assertIn('overriding close_fds', str(context.warning)) 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): def test_wait_when_sigchild_ignored(self):
# NOTE: sigchild_ignore.py may not be an effective test on all OSes. # NOTE: sigchild_ignore.py may not be an effective test on all OSes.
sigchild_ignore = support.findfile("sigchild_ignore.py", sigchild_ignore = support.findfile("sigchild_ignore.py",
...@@ -1528,19 +1547,6 @@ class ContextManagerTests(ProcessTestCase): ...@@ -1528,19 +1547,6 @@ class ContextManagerTests(ProcessTestCase):
raise c.exception 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__": if __name__ == "__main__":
test_main() unittest.main()
support.reap_children()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment