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

Side by Side Diff: tests/gclient_utils_test.py

Issue 3174020: Add stdout param to SubprocessCallAndFilter(). (Closed)
Patch Set: fix unit test Created 10 years, 4 months 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 unified diff | Download patch
« no previous file with comments | « scm.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import StringIO 6 import StringIO
7 7
8 # Fixes include path. 8 # Fixes include path.
9 from super_mox import SuperMoxTestBase 9 from super_mox import SuperMoxTestBase
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 class ProcessIdMock(object): 81 class ProcessIdMock(object):
82 def __init__(self, test_string): 82 def __init__(self, test_string):
83 self.stdout = StringIO.StringIO(test_string) 83 self.stdout = StringIO.StringIO(test_string)
84 def wait(self): 84 def wait(self):
85 pass 85 pass
86 86
87 def _inner(self, command, test_string): 87 def _inner(self, command, test_string):
88 in_directory = 'bleh' 88 in_directory = 'bleh'
89 env = gclient_utils.os.environ.copy() 89 env = gclient_utils.os.environ.copy()
90 env['LANGUAGE'] = 'en' 90 env['LANGUAGE'] = 'en'
91 print("\n________ running 'boo foo bar' in 'bleh'") 91 gclient_utils.sys.stdout.write(
92 '\n________ running \'boo foo bar\' in \'bleh\'\n')
92 for i in test_string: 93 for i in test_string:
93 gclient_utils.sys.stdout.write(i) 94 gclient_utils.sys.stdout.write(i)
94 gclient_utils.subprocess.Popen( 95 gclient_utils.subprocess.Popen(
95 command, 96 command,
96 cwd=in_directory, 97 cwd=in_directory,
97 shell=(gclient_utils.sys.platform == 'win32'), 98 shell=(gclient_utils.sys.platform == 'win32'),
98 env=env, 99 env=env,
99 stdout=gclient_utils.subprocess.PIPE, 100 stdout=gclient_utils.subprocess.PIPE,
100 stderr=gclient_utils.subprocess.STDOUT, 101 stderr=gclient_utils.subprocess.STDOUT,
101 bufsize=0).AndReturn(self.ProcessIdMock(test_string)) 102 bufsize=0).AndReturn(self.ProcessIdMock(test_string))
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) 165 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
165 self.assertEquals(out_rev, rev) 166 self.assertEquals(out_rev, rev)
166 self.assertEquals(out_url, url) 167 self.assertEquals(out_url, url)
167 168
168 169
169 if __name__ == '__main__': 170 if __name__ == '__main__':
170 import unittest 171 import unittest
171 unittest.main() 172 unittest.main()
172 173
173 # vim: ts=2:sw=2:tw=80:et: 174 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698