#2777: Apply same recipe for test_terminate and test_kill, i.e. close or redirect fds.

This commit is contained in:
Florent Xicluna 2010-03-06 00:16:57 +00:00
parent d77eb9a839
commit af9a06a77f
1 changed files with 4 additions and 2 deletions

View File

@ -673,14 +673,16 @@ class POSIXProcessTestCase(unittest.TestCase):
self.assertNotEqual(p.wait(), 0)
def test_kill(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
p = subprocess.Popen([sys.executable, "-c", "input()"],
stdin=subprocess.PIPE, close_fds=True)
self.assertIsNone(p.poll())
p.kill()
self.assertEqual(p.wait(), -signal.SIGKILL)
def test_terminate(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
p = subprocess.Popen([sys.executable, "-c", "input()"],
stdin=subprocess.PIPE, close_fds=True)
self.assertIsNone(p.poll())
p.terminate()