]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Add a test for subprocess with stderr as a separate stream
authorBen Darnell <ben@bendarnell.com>
Sat, 16 Feb 2013 16:18:50 +0000 (11:18 -0500)
committerBen Darnell <ben@bendarnell.com>
Sat, 16 Feb 2013 16:18:50 +0000 (11:18 -0500)
tornado/test/process_test.py

index db03906d54cab57e08c536e570b66452c2786a12..918f3bbd60a508f39531938c9ab0c88020ee2e5c 100644 (file)
@@ -154,6 +154,16 @@ class SubprocessTest(AsyncTestCase):
         data = self.wait()
         self.assertEqual(data, b"")
 
+    def test_stderr(self):
+        subproc = Subprocess([sys.executable, '-u', '-c',
+                              r"import sys; sys.stderr.write('hello\n')"],
+                             stderr=Subprocess.STREAM,
+                             io_loop=self.io_loop)
+        self.addCleanup(lambda: os.kill(subproc.pid, signal.SIGTERM))
+        subproc.stderr.read_until(b'\n', self.stop)
+        data = self.wait()
+        self.assertEqual(data, b'hello\n')
+
     def test_sigchild(self):
         # Twisted's SIGCHLD handler and Subprocess's conflict with each other.
         skip_if_twisted()