From: Ben Darnell Date: Sat, 16 Feb 2013 16:18:50 +0000 (-0500) Subject: Add a test for subprocess with stderr as a separate stream X-Git-Tag: v3.0.0~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ddbb7e8adcf01095684fba442dcd38ff978356a5;p=thirdparty%2Ftornado.git Add a test for subprocess with stderr as a separate stream --- diff --git a/tornado/test/process_test.py b/tornado/test/process_test.py index db03906d5..918f3bbd6 100644 --- a/tornado/test/process_test.py +++ b/tornado/test/process_test.py @@ -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()