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

Side by Side Diff: tests/gclient_utils_test.py

Issue 3398008: Directly hook sys.stdout for thread annotated output. (Closed)
Patch Set: Fix small errors, smoke tests rock. Created 10 years, 3 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 | « gclient_utils.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
11 import gclient_utils 11 import gclient_utils
12 12
13 13
14 class GclientUtilBase(SuperMoxTestBase): 14 class GclientUtilBase(SuperMoxTestBase):
15 def setUp(self): 15 def setUp(self):
16 super(GclientUtilBase, self).setUp() 16 super(GclientUtilBase, self).setUp()
17 gclient_utils.sys.stdout.flush = lambda: None 17 gclient_utils.sys.stdout.flush = lambda: None
18 self.mox.StubOutWithMock(gclient_utils, 'Popen') 18 self.mox.StubOutWithMock(gclient_utils, 'Popen')
19 19
20 20
21 class GclientUtilsUnittest(GclientUtilBase): 21 class GclientUtilsUnittest(GclientUtilBase):
22 """General gclient_utils.py tests.""" 22 """General gclient_utils.py tests."""
23 def testMembersChanged(self): 23 def testMembersChanged(self):
24 members = [ 24 members = [
25 'CheckCall', 'CheckCallError', 'CheckCallAndFilter', 25 'CheckCall', 'CheckCallError', 'CheckCallAndFilter',
26 'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead', 26 'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead',
27 'FileWrite', 'FindFileUpwards', 'FindGclientRoot', 27 'FileWrite', 'FindFileUpwards', 'FindGclientRoot',
28 'GetGClientRootAndEntries', 'GetNamedNodeText', 'MakeFileAutoFlush', 28 'GetGClientRootAndEntries', 'GetNamedNodeText', 'MakeFileAutoFlush',
29 'GetNodeNamedAttributeText', 'PathDifference', 'ParseXML', 'Popen', 29 'GetNodeNamedAttributeText', 'MakeFileAnnotated', 'PathDifference',
30 'ParseXML', 'Popen',
30 'PrintableObject', 'RemoveDirectory', 'SoftClone', 'SplitUrlRevision', 31 'PrintableObject', 'RemoveDirectory', 'SoftClone', 'SplitUrlRevision',
31 'StdoutAnnotated', 'SyntaxErrorToError', 'WorkItem', 32 'SyntaxErrorToError', 'WorkItem',
32 'copy', 'errno', 'logging', 'os', 'Queue', 're', 'stat', 'subprocess', 33 'copy', 'errno', 'logging', 'os', 'Queue', 're', 'stat', 'subprocess',
33 'sys','threading', 'time', 'xml', 34 'sys','threading', 'time', 'xml',
34 ] 35 ]
35 # If this test fails, you should add the relevant test. 36 # If this test fails, you should add the relevant test.
36 self.compareMembers(gclient_utils, members) 37 self.compareMembers(gclient_utils, members)
37 38
38 39
39 class CheckCallTestCase(GclientUtilBase): 40 class CheckCallTestCase(GclientUtilBase):
40 def testCheckCallSuccess(self): 41 def testCheckCallSuccess(self):
41 args = ['boo', 'foo', 'bar'] 42 args = ['boo', 'foo', 'bar']
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) 156 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
156 self.assertEquals(out_rev, rev) 157 self.assertEquals(out_rev, rev)
157 self.assertEquals(out_url, url) 158 self.assertEquals(out_url, url)
158 159
159 160
160 if __name__ == '__main__': 161 if __name__ == '__main__':
161 import unittest 162 import unittest
162 unittest.main() 163 unittest.main()
163 164
164 # vim: ts=2:sw=2:tw=80:et: 165 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698