Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: tests/subprocess2_test.py

Issue 8695003: Add more subprocess2 tests with stderr=subproces2.STDOUT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix comment Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/subprocess2_test.py
diff --git a/tests/subprocess2_test.py b/tests/subprocess2_test.py
index 0e4187d7e4e6a63c80ee64223a6474eb6713ac0f..edb60323ddea499e31d8feab704c901e9d439514 100755
--- a/tests/subprocess2_test.py
+++ b/tests/subprocess2_test.py
@@ -255,6 +255,31 @@ class S2Test(unittest.TestCase):
self.assertEquals(0, code)
self._run_test(fn)
+ def test_check_output_redirect_stderr_to_stdout_pipe(self):
+ def fn(c, e, un):
+ (out, err), code = subprocess2.communicate(
+ e + ['--stderr'],
+ stdout=subprocess2.PIPE,
+ stderr=subprocess2.STDOUT,
+ universal_newlines=un)
+ # stderr output into stdout.
+ self.assertEquals(c('a\nbb\nccc\n'), out)
+ self.assertEquals(None, err)
+ self.assertEquals(0, code)
+ self._run_test(fn)
+
+ def test_check_output_redirect_stderr_to_stdout(self):
+ def fn(c, e, un):
+ (out, err), code = subprocess2.communicate(
+ e + ['--stderr'],
+ stderr=subprocess2.STDOUT,
+ universal_newlines=un)
+ # stderr output into stdout but stdout is not piped.
+ self.assertEquals(None, out)
+ self.assertEquals(None, err)
+ self.assertEquals(0, code)
+ self._run_test(fn)
+
def test_check_output_throw_stdout(self):
def fn(c, e, un):
try:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698