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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 [ | 713 [ |
714 'svn://example.com/foo', | 714 'svn://example.com/foo', |
715 'svn://example.com/bar', | 715 'svn://example.com/bar', |
716 'svn://example.com/tar', | 716 'svn://example.com/tar', |
717 'svn://example.com/foo/bar', | 717 'svn://example.com/foo/bar', |
718 'svn://example.com/foo/bar/baz', | 718 'svn://example.com/foo/bar/baz', |
719 'svn://example.com/foo/bar/baz/fizz', | 719 'svn://example.com/foo/bar/baz/fizz', |
720 ], | 720 ], |
721 self._get_processed()) | 721 self._get_processed()) |
722 | 722 |
| 723 def testRecursedepsOverrideWithRelativePaths(self): |
| 724 """Verifies gclient respects |recursedeps| with relative paths.""" |
| 725 |
| 726 write( |
| 727 '.gclient', |
| 728 'solutions = [\n' |
| 729 ' { "name": "foo", "url": "svn://example.com/foo" },\n' |
| 730 ']') |
| 731 write( |
| 732 os.path.join('foo', 'DEPS'), |
| 733 'use_relative_paths = True\n' |
| 734 'deps = {\n' |
| 735 ' "bar": "/bar",\n' |
| 736 '}\n' |
| 737 'recursedeps = {"bar"}') |
| 738 write( |
| 739 os.path.join('bar', 'DEPS'), |
| 740 'deps = {\n' |
| 741 ' "baz": "/baz",\n' |
| 742 '}') |
| 743 write( |
| 744 os.path.join('baz', 'DEPS'), |
| 745 'deps = {\n' |
| 746 ' "fizz": "/fizz",\n' |
| 747 '}') |
| 748 |
| 749 options, _ = gclient.OptionParser().parse_args([]) |
| 750 obj = gclient.GClient.LoadCurrentConfig(options) |
| 751 obj.RunOnDeps('None', []) |
| 752 self.assertEquals( |
| 753 [ |
| 754 'svn://example.com/foo', |
| 755 # use_relative_paths means the following dep evaluates with 'foo' |
| 756 # prepended. |
| 757 'svn://example.com/foo/bar', |
| 758 ], |
| 759 self._get_processed()) |
| 760 |
723 def testRecursionOverridesRecursedeps(self): | 761 def testRecursionOverridesRecursedeps(self): |
724 """Verifies gclient respects |recursion| over |recursedeps|. | 762 """Verifies gclient respects |recursion| over |recursedeps|. |
725 | 763 |
726 |recursion| is set in a top-level DEPS file. That value is meant | 764 |recursion| is set in a top-level DEPS file. That value is meant |
727 to affect how many subdeps are parsed via recursion. | 765 to affect how many subdeps are parsed via recursion. |
728 | 766 |
729 |recursedeps| is set in each DEPS file to control whether or not | 767 |recursedeps| is set in each DEPS file to control whether or not |
730 to recurse into the immediate next subdep. | 768 to recurse into the immediate next subdep. |
731 | 769 |
732 This test verifies that if both syntaxes are mixed in a DEPS file, | 770 This test verifies that if both syntaxes are mixed in a DEPS file, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 912 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
875 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 913 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
876 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 914 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
877 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 915 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
878 logging.basicConfig( | 916 logging.basicConfig( |
879 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 917 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
880 min(sys.argv.count('-v'), 3)], | 918 min(sys.argv.count('-v'), 3)], |
881 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 919 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
882 '%(lineno)d) %(message)s') | 920 '%(lineno)d) %(message)s') |
883 unittest.main() | 921 unittest.main() |
OLD | NEW |