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

Side by Side Diff: tests/gclient_test.py

Issue 8298002: Do not sort solutions anymore, only dependencies specified in DEPS files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « gclient.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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """Unit tests for gclient.py. 6 """Unit tests for gclient.py.
7 7
8 See gclient_smoketest.py for integration tests. 8 See gclient_smoketest.py for integration tests.
9 """ 9 """
10 10
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 [ 150 [
151 'svn://example.com/foo/dir1', 151 'svn://example.com/foo/dir1',
152 'svn://example.com/bar/dir1/dir2', 152 'svn://example.com/bar/dir1/dir2',
153 'svn://example.com/foo/dir1/dir2/dir3', 153 'svn://example.com/foo/dir1/dir2/dir3',
154 'svn://example.com/foo/dir1/dir2/dir3/dir4', 154 'svn://example.com/foo/dir1/dir2/dir3/dir4',
155 'svn://example.com/foo/dir1/dir2/dir3/dir4/dir1/another', 155 'svn://example.com/foo/dir1/dir2/dir3/dir4/dir1/another',
156 ], 156 ],
157 actual[3:]) 157 actual[3:])
158 158
159 self.assertEquals(3, len(obj.dependencies)) 159 self.assertEquals(3, len(obj.dependencies))
160 self.assertEquals('bar', obj.dependencies[0].name) 160 self.assertEquals('foo', obj.dependencies[0].name)
161 self.assertEquals('bar/empty', obj.dependencies[1].name) 161 self.assertEquals('bar', obj.dependencies[1].name)
162 self.assertEquals('foo', obj.dependencies[2].name) 162 self.assertEquals('bar/empty', obj.dependencies[2].name)
163 self._check_requirements( 163 self._check_requirements(
164 obj.dependencies[0], 164 obj.dependencies[0],
165 { 165 {
166 'foo/dir1/dir2': ['bar', 'bar/empty', 'foo', 'foo/dir1'],
167 })
168 self._check_requirements(
169 obj.dependencies[1],
170 {})
171 self._check_requirements(
172 obj.dependencies[2],
173 {
174 'foo/dir1': ['bar', 'bar/empty', 'foo'], 166 'foo/dir1': ['bar', 'bar/empty', 'foo'],
175 'foo/dir1/dir2/dir3': 167 'foo/dir1/dir2/dir3':
176 ['bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2'], 168 ['bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2'],
177 'foo/dir1/dir2/dir3/dir4': 169 'foo/dir1/dir2/dir3/dir4':
178 [ 'bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2', 170 [ 'bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2',
179 'foo/dir1/dir2/dir3'], 171 'foo/dir1/dir2/dir3'],
180 'foo/dir1/dir2/dir5/dir6': 172 'foo/dir1/dir2/dir5/dir6':
181 [ 'bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2', 173 [ 'bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2',
182 'foo/dir1/dir2/dir3/dir4'], 174 'foo/dir1/dir2/dir3/dir4'],
183 }) 175 })
184 self._check_requirements( 176 self._check_requirements(
177 obj.dependencies[1],
178 {
179 'foo/dir1/dir2': ['bar', 'bar/empty', 'foo', 'foo/dir1'],
180 })
181 self._check_requirements(
182 obj.dependencies[2],
183 {})
184 self._check_requirements(
185 obj, 185 obj,
186 { 186 {
187 'foo': [], 187 'foo': [],
188 'bar': [], 188 'bar': [],
189 'bar/empty': ['bar'], 189 'bar/empty': ['bar'],
190 }) 190 })
191 191
192 def _check_requirements(self, solution, expected): 192 def _check_requirements(self, solution, expected):
193 for dependency in solution.dependencies: 193 for dependency in solution.dependencies:
194 e = expected.pop(dependency.name) 194 e = expected.pop(dependency.name)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) 252 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
253 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) 253 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
254 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) 254 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
255 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) 255 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
256 logging.basicConfig( 256 logging.basicConfig(
257 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ 257 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
258 min(sys.argv.count('-v'), 3)], 258 min(sys.argv.count('-v'), 3)],
259 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' 259 format='%(relativeCreated)4d %(levelname)5s %(module)13s('
260 '%(lineno)d) %(message)s') 260 '%(lineno)d) %(message)s')
261 unittest.main() 261 unittest.main()
OLDNEW
« no previous file with comments | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698