OLD | NEW |
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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 {'foo': 'default_foo', | 552 {'foo': 'default_foo', |
553 'bar': 'os12_bar'} | 553 'bar': 'os12_bar'} |
554 ), | 554 ), |
555 ] | 555 ] |
556 for deps, deps_os, target_os_list, expected_deps in test_data: | 556 for deps, deps_os, target_os_list, expected_deps in test_data: |
557 orig_deps = copy.deepcopy(deps) | 557 orig_deps = copy.deepcopy(deps) |
558 result = gclient.Dependency.MergeWithOsDeps(deps, deps_os, target_os_list) | 558 result = gclient.Dependency.MergeWithOsDeps(deps, deps_os, target_os_list) |
559 self.assertEqual(result, expected_deps) | 559 self.assertEqual(result, expected_deps) |
560 self.assertEqual(deps, orig_deps) | 560 self.assertEqual(deps, orig_deps) |
561 | 561 |
| 562 |
| 563 def testLateOverride(self): |
| 564 """Verifies expected behavior of LateOverride.""" |
| 565 url = "git@github.com:dart-lang/spark.git" |
| 566 d = gclient.Dependency(None, 'name', 'url', |
| 567 None, None, None, None, None, '', True) |
| 568 late_url = d.LateOverride(url) |
| 569 self.assertEquals(url, late_url) |
| 570 |
562 def testDepsOsOverrideDepsInDepsFile(self): | 571 def testDepsOsOverrideDepsInDepsFile(self): |
563 """Verifies that a 'deps_os' path can override a 'deps' path. Also | 572 """Verifies that a 'deps_os' path can override a 'deps' path. Also |
564 see testUpdateWithOsDeps above. | 573 see testUpdateWithOsDeps above. |
565 """ | 574 """ |
566 | 575 |
567 write( | 576 write( |
568 '.gclient', | 577 '.gclient', |
569 'solutions = [\n' | 578 'solutions = [\n' |
570 ' { "name": "foo",\n' | 579 ' { "name": "foo",\n' |
571 ' "url": "svn://example.com/foo",\n' | 580 ' "url": "svn://example.com/foo",\n' |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 665 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
657 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 666 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
658 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 667 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
659 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 668 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
660 logging.basicConfig( | 669 logging.basicConfig( |
661 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 670 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
662 min(sys.argv.count('-v'), 3)], | 671 min(sys.argv.count('-v'), 3)], |
663 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 672 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
664 '%(lineno)d) %(message)s') | 673 '%(lineno)d) %(message)s') |
665 unittest.main() | 674 unittest.main() |
OLD | NEW |