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

Side by Side Diff: tests/gclient_utils_test.py

Issue 3737001: Fix a bug in gclient recurse for git-svn users. Make gclient_utils.CheckCall more versatile. (Closed)
Patch Set: Created 10 years, 2 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') | trychange.py » ('j') | 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 25 matching lines...) Expand all
36 # If this test fails, you should add the relevant test. 36 # If this test fails, you should add the relevant test.
37 self.compareMembers(gclient_utils, members) 37 self.compareMembers(gclient_utils, members)
38 38
39 39
40 class CheckCallTestCase(GclientUtilBase): 40 class CheckCallTestCase(GclientUtilBase):
41 def testCheckCallSuccess(self): 41 def testCheckCallSuccess(self):
42 args = ['boo', 'foo', 'bar'] 42 args = ['boo', 'foo', 'bar']
43 process = self.mox.CreateMockAnything() 43 process = self.mox.CreateMockAnything()
44 process.returncode = 0 44 process.returncode = 0
45 gclient_utils.Popen( 45 gclient_utils.Popen(
46 args, cwd=None, 46 args, cwd='bar',
47 stderr=None, 47 stderr=None,
48 stdout=gclient_utils.subprocess.PIPE).AndReturn(process) 48 stdout=gclient_utils.subprocess.PIPE).AndReturn(process)
49 process.communicate().AndReturn(['bleh', 'foo']) 49 process.communicate().AndReturn(['bleh', 'foo'])
50 self.mox.ReplayAll() 50 self.mox.ReplayAll()
51 gclient_utils.CheckCall(args) 51 gclient_utils.CheckCall(args, cwd='bar')
52 52
53 def testCheckCallFailure(self): 53 def testCheckCallFailure(self):
54 args = ['boo', 'foo', 'bar'] 54 args = ['boo', 'foo', 'bar']
55 process = self.mox.CreateMockAnything() 55 process = self.mox.CreateMockAnything()
56 process.returncode = 42 56 process.returncode = 42
57 gclient_utils.Popen( 57 gclient_utils.Popen(
58 args, cwd=None, 58 args,
59 stderr=None, 59 stderr=None,
60 stdout=gclient_utils.subprocess.PIPE).AndReturn(process) 60 stdout=gclient_utils.subprocess.PIPE).AndReturn(process)
61 process.communicate().AndReturn(['bleh', 'foo']) 61 process.communicate().AndReturn(['bleh', 'foo'])
62 self.mox.ReplayAll() 62 self.mox.ReplayAll()
63 try: 63 try:
64 gclient_utils.CheckCall(args) 64 gclient_utils.CheckCall(args)
65 self.fail() 65 self.fail()
66 except gclient_utils.CheckCallError, e: 66 except gclient_utils.CheckCallError, e:
67 self.assertEqual(e.command, args) 67 self.assertEqual(e.command, args)
68 self.assertEqual(e.cwd, None) 68 self.assertEqual(e.cwd, None)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) 162 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
163 self.assertEquals(out_rev, rev) 163 self.assertEquals(out_rev, rev)
164 self.assertEquals(out_url, url) 164 self.assertEquals(out_url, url)
165 165
166 166
167 if __name__ == '__main__': 167 if __name__ == '__main__':
168 import unittest 168 import unittest
169 unittest.main() 169 unittest.main()
170 170
171 # vim: ts=2:sw=2:tw=80:et: 171 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_utils.py ('k') | trychange.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698