]> granicus.if.org Git - python/commitdiff
The standard error should be empty when the signal is killed, except on SIGINT.
authorFlorent Xicluna <florent.xicluna@gmail.com>
Tue, 23 Mar 2010 15:05:30 +0000 (15:05 +0000)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Tue, 23 Mar 2010 15:05:30 +0000 (15:05 +0000)
Lib/test/test_subprocess.py

index e0744d270b8ce699034248b36838ae8d4e22ae03..19eed154ea479b2b437f3f456942c3f5eebc93b2 100644 (file)
@@ -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 \"<string>\", line 1, in <module>\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)