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

Unified Diff: tests/gclient_test.py

Issue 1356005: Add the ability to check out a single file from a repo.... (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 8 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
« no previous file with comments | « tests/gclient_scm_test.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 43902)
+++ tests/gclient_test.py (working copy)
@@ -213,9 +213,6 @@
class TestDoUpdate(GenericCommandTestCase):
- def Options(self, verbose=False, *args, **kwargs):
- return self.OptionsObject(self, verbose=verbose, *args, **kwargs)
-
def ReturnValue(self, command, function, return_value):
options = self.Options()
gclient.GClient.LoadCurrentConfig(options).AndReturn(gclient.GClient)
@@ -302,7 +299,7 @@
class GClientClassTestCase(GclientTestCase):
def testDir(self):
members = [
- 'ConfigContent', 'FromImpl', 'GetVar', 'LoadCurrentConfig',
+ 'ConfigContent', 'FileImpl', 'FromImpl', 'GetVar', 'LoadCurrentConfig',
'RunOnDeps', 'SaveConfig', 'SetConfig', 'SetDefaultConfig',
'supported_commands', 'PrintRevInfo',
]
@@ -1033,6 +1030,48 @@
# TODO(maruel): Test me!
pass
+ def testFileImpl(self):
+ # Fake .gclient file.
+ name = "testFileImpl"
+ gclient_config = (
+ "solutions = [ { 'name': '%s',"
+ "'url': '%s', } ]" % (name, self.url)
+ )
+ # Fake DEPS file.
+ target = "chromium_deps"
+ deps_content = (
+ "deps = {"
+ " '%s': File('%s/DEPS') }" % (target, self.url)
+ )
+
+ gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn(
+ gclient.gclient_scm.CreateSCM)
+ options = self.Options()
+ gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
+ gclient.gclient_utils.FileRead(
+ gclient.os.path.join(self.root_dir, name, options.deps_file)
+ ).AndReturn(deps_content)
+ gclient.os.path.exists(
+ gclient.os.path.join(self.root_dir, name, '.git')
+ ).AndReturn(False)
+ gclient.os.path.exists(
+ gclient.os.path.join(self.root_dir, options.entries_filename)
+ ).AndReturn(False)
+
+ # This is where gclient tries to do the initial checkout.
+ gclient.gclient_scm.CreateSCM(self.url, self.root_dir, target).AndReturn(
+ gclient.gclient_scm.CreateSCM)
+ gclient.gclient_scm.CreateSCM.RunCommand('updatesingle', options,
+ self.args + ["DEPS"], [])
+ gclient.gclient_utils.FileWrite(
+ gclient.os.path.join(self.root_dir, options.entries_filename),
+ "entries = \\\n{'%s': '%s'}\n" % (name, self.url))
+
+ self.mox.ReplayAll()
+ client = self._gclient_gclient(self.root_dir, options)
+ client.SetConfig(gclient_config)
+ client.RunOnDeps('update', self.args)
+
def test_PrintRevInfo(self):
# TODO(aharper): no test yet for revinfo, lock it down once we've verified
# implementation for Pulse plugin
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698