Index: Lib/test/test_subprocess.py =================================================================== --- Lib/test/test_subprocess.py 2009-10-15 23:51:58.000000000 +0200 +++ Lib/test/test_subprocess.py 2009-10-16 00:02:10.000000000 +0200 @@ -648,7 +648,8 @@ os.remove(fname) self.assertEqual(rc, 47) - def DISABLED_test_send_signal(self): + def test_send_signal(self): + # send_signal() to the child process p = subprocess.Popen([sys.executable, "-c", "input()"]) @@ -656,7 +657,8 @@ p.send_signal(signal.SIGINT) self.assertNotEqual(p.wait(), 0) - def DISABLED_test_kill(self): + def test_kill(self): + # kill() the child process p = subprocess.Popen([sys.executable, "-c", "input()"]) @@ -664,7 +666,8 @@ p.kill() self.assertEqual(p.wait(), -signal.SIGKILL) - def DISABLED_test_terminate(self): + def test_terminate(self): + # terminate() the child process p = subprocess.Popen([sys.executable, "-c", "input()"]) @@ -672,6 +675,17 @@ p.terminate() self.assertEqual(p.wait(), -signal.SIGTERM) + def test_terminate_already_terminated_child(self): + # try to terminate an already terminated child + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assertTrue(p.poll() is None, p.poll()) + p.terminate() + self.assertEqual(p.wait(), -signal.SIGTERM) + # now that the child has been terminated, we should get an OSError if + # we try to terminate that pid + self.assertRaises(OSError, p.terminate) # # Windows tests # @@ -742,7 +756,8 @@ ' -c "import sys; sys.exit(47)"') self.assertEqual(rc, 47) - def DISABLED_test_send_signal(self): + def test_send_signal(self): + # send a signal to the child process. Only SIGTERM is supported p = subprocess.Popen([sys.executable, "-c", "input()"]) @@ -750,7 +765,8 @@ p.send_signal(signal.SIGTERM) self.assertNotEqual(p.wait(), 0) - def DISABLED_test_kill(self): + def test_kill(self): + # kill() the child process p = subprocess.Popen([sys.executable, "-c", "input()"]) @@ -758,7 +774,8 @@ p.kill() self.assertNotEqual(p.wait(), 0) - def DISABLED_test_terminate(self): + def test_terminate(self): + # terminate() the child process p = subprocess.Popen([sys.executable, "-c", "input()"]) @@ -766,6 +783,17 @@ p.terminate() self.assertNotEqual(p.wait(), 0) + def test_terminate_already_terminated_child(self): + # try to terminate an already terminated child + p = subprocess.Popen([sys.executable, + "-c", "input()"]) + + self.assertTrue(p.poll() is None, p.poll()) + p.terminate() + self.assertEqual(p.wait(), -signal.SIGTERM) + # now that the child has been terminated, we should get an OSError if + # we try to terminate that pid + self.assertRaises(OSError, p.terminate) unit_tests = [ProcessTestCase]