From 446ff14827e9ef7373f5170f33e4913c4ab10025 Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Tue, 23 Mar 2010 15:05:30 +0000 Subject: [PATCH] The standard error should be empty when the signal is killed, except on SIGINT. --- Lib/test/test_subprocess.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index e0744d270b8..19eed154ea4 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -669,18 +669,22 @@ class POSIXProcessTestCase(BaseTestCase): def test_send_signal(self): p = self._kill_process('send_signal', signal.SIGINT) _, stderr = p.communicate() - self.assertNotEqual(p.wait(), 0) self.assertStderrEqual(stderr, "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "KeyboardInterrupt\n") + self.assertNotEqual(p.wait(), 0) def test_kill(self): p = self._kill_process('kill') + _, stderr = p.communicate() + self.assertStderrEqual(stderr, '') self.assertEqual(p.wait(), -signal.SIGKILL) def test_terminate(self): p = self._kill_process('terminate') + _, stderr = p.communicate() + self.assertStderrEqual(stderr, '') self.assertEqual(p.wait(), -signal.SIGTERM) @@ -756,7 +760,7 @@ class Win32ProcessTestCase(BaseTestCase): def _kill_process(self, method, *args): # Some win32 buildbot raises EOFError if stdin is inherited p = subprocess.Popen([sys.executable, "-c", "input()"], - stdin=subprocess.PIPE) + stdin=subprocess.PIPE, stderr=subprocess.PIPE) # Let the process initialize (Issue #3137) time.sleep(0.1) @@ -774,6 +778,8 @@ class Win32ProcessTestCase(BaseTestCase): if count > 1: print >>sys.stderr, ("p.{}{} succeeded after " "{} attempts".format(method, args, count)) + _, stderr = p.communicate() + self.assertStderrEqual(stderr, '') self.assertEqual(p.wait(), returncode) self.assertNotEqual(returncode, 0)