Index: tests/gclient_test.py |
diff --git a/tests/gclient_test.py b/tests/gclient_test.py |
index fb6577913e248408e84a689219b4cc2fd4ba35c8..0d5b235a7c6e15541b2925812a876b9520b53ef5 100755 |
--- a/tests/gclient_test.py |
+++ b/tests/gclient_test.py |
@@ -809,6 +809,66 @@ class GclientTest(trial_dir.TestCase): |
], |
self._get_processed()) |
+ def testGitDeps(self): |
+ """Verifies gclient respects a .DEPS.git deps file. |
+ |
+ Along the way, we also test that if both DEPS and .DEPS.git are present, |
+ that gclient does not read the DEPS file. This will reliably catch bugs |
+ where gclient is always hitting the wrong file (DEPS). |
+ """ |
+ write( |
+ '.gclient', |
+ 'solutions = [\n' |
+ ' { "name": "foo", "url": "svn://example.com/foo",\n' |
+ ' "deps_file" : ".DEPS.git",\n' |
+ ' },\n' |
+ ']') |
+ write( |
+ os.path.join('foo', '.DEPS.git'), |
+ 'deps = {\n' |
+ ' "bar": "/bar",\n' |
+ '}') |
+ write( |
+ os.path.join('foo', 'DEPS'), |
+ 'deps = {\n' |
+ ' "baz": "/baz",\n' |
+ '}') |
+ |
+ options, _ = gclient.OptionParser().parse_args([]) |
+ obj = gclient.GClient.LoadCurrentConfig(options) |
+ obj.RunOnDeps('None', []) |
+ self.assertEquals( |
+ [ |
+ 'svn://example.com/foo', |
+ 'svn://example.com/foo/bar', |
+ ], |
+ self._get_processed()) |
+ |
+ def testGitDepsFallback(self): |
+ """Verifies gclient respects fallback to DEPS upon missing deps file.""" |
+ write( |
+ '.gclient', |
+ 'solutions = [\n' |
+ ' { "name": "foo", "url": "svn://example.com/foo",\n' |
+ ' "deps_file" : ".DEPS.git",\n' |
+ ' },\n' |
+ ']') |
+ write( |
+ os.path.join('foo', 'DEPS'), |
+ 'deps = {\n' |
+ ' "bar": "/bar",\n' |
+ '}') |
+ |
+ options, _ = gclient.OptionParser().parse_args([]) |
+ obj = gclient.GClient.LoadCurrentConfig(options) |
+ obj.RunOnDeps('None', []) |
+ self.assertEquals( |
+ [ |
+ 'svn://example.com/foo', |
+ 'svn://example.com/foo/bar', |
+ ], |
+ self._get_processed()) |
+ |
if __name__ == '__main__': |
sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |