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

Side by Side Diff: tests/gclient_test.py

Issue 11274037: Improve the test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 1 month 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 | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 The target_os variable in a DEPS file allows specifying the name of an 314 The target_os variable in a DEPS file allows specifying the name of an
315 additional OS which should be considered when selecting dependencies from a 315 additional OS which should be considered when selecting dependencies from a
316 DEPS' deps_os. The value will be appended to the _enforced_os tuple. 316 DEPS' deps_os. The value will be appended to the _enforced_os tuple.
317 """ 317 """
318 318
319 write( 319 write(
320 '.gclient', 320 '.gclient',
321 'solutions = [\n' 321 'solutions = [\n'
322 ' { "name": "foo",\n' 322 ' { "name": "foo",\n'
323 ' "url": "svn://example.com/foo",\n' 323 ' "url": "svn://example.com/foo",\n'
324 ' },\n'
325 ' { "name": "bar",\n'
326 ' "url": "svn://example.com/bar",\n'
324 ' }]\n') 327 ' }]\n')
325 write( 328 write(
326 os.path.join('foo', 'DEPS'), 329 os.path.join('foo', 'DEPS'),
327 'target_os = ["baz"]\n' 330 'target_os = ["baz"]\n'
328 'deps_os = {\n' 331 'deps_os = {\n'
329 ' "unix": { "foo/unix": "/unix", },\n' 332 ' "unix": { "foo/unix": "/unix", },\n'
330 ' "baz": { "foo/baz": "/baz", },\n' 333 ' "baz": { "foo/baz": "/baz", },\n'
331 ' "jaz": { "foo/jaz": "/jaz", },\n' 334 ' "jaz": { "foo/jaz": "/jaz", },\n'
332 '}') 335 '}')
336 write(
337 os.path.join('bar', 'DEPS'),
338 'deps_os = {\n'
339 ' "unix": { "bar/unix": "/unix", },\n'
340 ' "baz": { "bar/baz": "/baz", },\n'
341 ' "jaz": { "bar/jaz": "/jaz", },\n'
342 '}')
333 343
334 parser = gclient.Parser() 344 parser = gclient.Parser()
335 options, _ = parser.parse_args(['--jobs', '1']) 345 options, _ = parser.parse_args(['--jobs', '1'])
336 options.deps_os = 'unix' 346 options.deps_os = 'unix'
337 347
338 obj = gclient.GClient.LoadCurrentConfig(options) 348 obj = gclient.GClient.LoadCurrentConfig(options)
339 obj.RunOnDeps('None', []) 349 obj.RunOnDeps('None', [])
340 self.assertEqual(['unix'], sorted(obj.enforced_os)) 350 self.assertEqual(['unix'], sorted(obj.enforced_os))
341 self.assertEquals( 351 self.assertEquals(
342 [ 352 [
353 'svn://example.com/bar',
354 'svn://example.com/bar/unix',
343 'svn://example.com/foo', 355 'svn://example.com/foo',
344 'svn://example.com/foo/baz', 356 'svn://example.com/foo/baz',
345 'svn://example.com/foo/unix', 357 'svn://example.com/foo/unix',
346 ], 358 ],
347 sorted(self._get_processed())) 359 sorted(self._get_processed()))
348 360
349 def testRecursionOverride(self): 361 def testRecursionOverride(self):
350 """Verifies gclient respects the recursion var syntax. 362 """Verifies gclient respects the recursion var syntax.
351 363
352 We check several things here: 364 We check several things here:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) 413 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
402 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) 414 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
403 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) 415 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
404 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) 416 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
405 logging.basicConfig( 417 logging.basicConfig(
406 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ 418 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
407 min(sys.argv.count('-v'), 3)], 419 min(sys.argv.count('-v'), 3)],
408 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' 420 format='%(relativeCreated)4d %(levelname)5s %(module)13s('
409 '%(lineno)d) %(message)s') 421 '%(lineno)d) %(message)s')
410 unittest.main() 422 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698