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

Unified Diff: tests/gclient_test.py

Issue 193004: Added "gclient pack" subcommand, which generates a patch relative to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« gclient.py ('K') | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_test.py
===================================================================
--- tests/gclient_test.py (revision 25297)
+++ tests/gclient_test.py (working copy)
@@ -20,6 +20,7 @@
import __builtin__
import os
+import re
import StringIO
import unittest
@@ -110,7 +111,7 @@
known_commands = [gclient.DoCleanup, gclient.DoConfig, gclient.DoDiff,
gclient.DoExport, gclient.DoHelp, gclient.DoStatus,
gclient.DoUpdate, gclient.DoRevert, gclient.DoRunHooks,
- gclient.DoRevInfo]
+ gclient.DoRevInfo, gclient.DoPack]
for (k,v) in gclient.gclient_command_map.iteritems():
# If it fails, you need to add a test case for the new command.
self.assert_(v in known_commands)
@@ -302,6 +303,18 @@
self.BadClient(gclient.DoExport)
+class TestDoPack(GenericCommandTestCase):
+ def Options(self, *args, **kwargs):
+ return self.OptionsObject(self, *args, **kwargs)
+
+ def testBasic(self):
+ self.ReturnValue('pack', gclient.DoPack, 0)
+ def testError(self):
+ self.ReturnValue('pack', gclient.DoPack, 42)
+ def testBadClient(self):
+ self.BadClient(gclient.DoPack)
+
+
class TestDoRevert(GenericCommandTestCase):
def testBasic(self):
self.ReturnValue('revert', gclient.DoRevert, 0)
@@ -1020,7 +1033,7 @@
def testDir(self):
members = [
'FullUrlForRelativeUrl', 'RunCommand', 'cleanup', 'diff', 'export',
- 'relpath', 'revert', 'scm_name', 'status', 'update', 'url',
+ 'pack', 'relpath', 'revert', 'scm_name', 'status', 'update', 'url',
]
# If you add a member, be sure to add the relevant test!
@@ -1260,12 +1273,12 @@
gclient.RunSVN(['foo', 'bar'], param2)
-class SubprocessCallAndCaptureTestCase(BaseTestCase):
+class SubprocessCallAndFilterTestCase(BaseTestCase):
def setUp(self):
BaseTestCase.setUp(self)
self.mox.StubOutWithMock(gclient, 'CaptureSVN')
- def testSubprocessCallAndCapture(self):
+ def testSubprocessCallAndFilter(self):
command = ['boo', 'foo', 'bar']
in_directory = 'bleh'
fail_status = None
@@ -1283,9 +1296,18 @@
shell=(gclient.sys.platform == 'win32'),
stdout=gclient.subprocess.PIPE).AndReturn(kid)
self.mox.ReplayAll()
+ compiled_pattern = re.compile(pattern)
+ line_list = []
capture_list = []
- gclient.SubprocessCallAndCapture(command, in_directory, fail_status,
- pattern, capture_list)
+ def FilterLines(line):
+ line_list.append(line)
+ match = compiled_pattern.search(line)
+ if match:
+ capture_list.append(match.group(1))
+ gclient.SubprocessCallAndFilter(command, in_directory,
+ True, True,
+ fail_status, FilterLines)
+ self.assertEquals(line_list, ['ahah', 'accb', 'allo', 'addb'])
self.assertEquals(capture_list, ['cc', 'dd'])
def testCaptureSVNStatus(self):
« gclient.py ('K') | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698