| 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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 'svn://example.com/foo/bar', | 657 'svn://example.com/foo/bar', |
| 658 'svn://example.com/foo/bar/baz', | 658 'svn://example.com/foo/bar/baz', |
| 659 'svn://example.com/foo/bar/baz/fizz', | 659 'svn://example.com/foo/bar/baz/fizz', |
| 660 ], | 660 ], |
| 661 self._get_processed()) | 661 self._get_processed()) |
| 662 | 662 |
| 663 def testRecursedepsOverride(self): | 663 def testRecursedepsOverride(self): |
| 664 """Verifies gclient respects the |recursedeps| var syntax. | 664 """Verifies gclient respects the |recursedeps| var syntax. |
| 665 | 665 |
| 666 This is what we mean to check here: | 666 This is what we mean to check here: |
| 667 - |recursedeps| = {...} on 2 levels means we pull exactly 3 deps | 667 - |recursedeps| = [...] on 2 levels means we pull exactly 3 deps |
| 668 (up to /fizz, but not /fuzz) | 668 (up to /fizz, but not /fuzz) |
| 669 - pulling foo/bar with no recursion (in .gclient) is overriden by | 669 - pulling foo/bar with no recursion (in .gclient) is overriden by |
| 670 a later pull of foo/bar with recursion (in the dep tree) | 670 a later pull of foo/bar with recursion (in the dep tree) |
| 671 - pulling foo/tar with no recursion (in .gclient) is no recursively | 671 - pulling foo/tar with no recursion (in .gclient) is no recursively |
| 672 pulled (taz is left out) | 672 pulled (taz is left out) |
| 673 """ | 673 """ |
| 674 write( | 674 write( |
| 675 '.gclient', | 675 '.gclient', |
| 676 'solutions = [\n' | 676 'solutions = [\n' |
| 677 ' { "name": "foo", "url": "svn://example.com/foo" },\n' | 677 ' { "name": "foo", "url": "svn://example.com/foo" },\n' |
| 678 ' { "name": "foo/bar", "url": "svn://example.com/bar" },\n' | 678 ' { "name": "foo/bar", "url": "svn://example.com/bar" },\n' |
| 679 ' { "name": "foo/tar", "url": "svn://example.com/tar" },\n' | 679 ' { "name": "foo/tar", "url": "svn://example.com/tar" },\n' |
| 680 ']') | 680 ']') |
| 681 write( | 681 write( |
| 682 os.path.join('foo', 'DEPS'), | 682 os.path.join('foo', 'DEPS'), |
| 683 'deps = {\n' | 683 'deps = {\n' |
| 684 ' "bar": "/bar",\n' | 684 ' "bar": "/bar",\n' |
| 685 '}\n' | 685 '}\n' |
| 686 'recursedeps = {"bar"}') | 686 'recursedeps = ["bar"]') |
| 687 write( | 687 write( |
| 688 os.path.join('bar', 'DEPS'), | 688 os.path.join('bar', 'DEPS'), |
| 689 'deps = {\n' | 689 'deps = {\n' |
| 690 ' "baz": "/baz",\n' | 690 ' "baz": "/baz",\n' |
| 691 '}\n' | 691 '}\n' |
| 692 'recursedeps = {"baz"}') | 692 'recursedeps = ["baz"]') |
| 693 write( | 693 write( |
| 694 os.path.join('baz', 'DEPS'), | 694 os.path.join('baz', 'DEPS'), |
| 695 'deps = {\n' | 695 'deps = {\n' |
| 696 ' "fizz": "/fizz",\n' | 696 ' "fizz": "/fizz",\n' |
| 697 '}') | 697 '}') |
| 698 write( | 698 write( |
| 699 os.path.join('fizz', 'DEPS'), | 699 os.path.join('fizz', 'DEPS'), |
| 700 'deps = {\n' | 700 'deps = {\n' |
| 701 ' "fuzz": "/fuzz",\n' | 701 ' "fuzz": "/fuzz",\n' |
| 702 '}') | 702 '}') |
| (...skipping 24 matching lines...) Expand all Loading... |
| 727 '.gclient', | 727 '.gclient', |
| 728 'solutions = [\n' | 728 'solutions = [\n' |
| 729 ' { "name": "foo", "url": "svn://example.com/foo" },\n' | 729 ' { "name": "foo", "url": "svn://example.com/foo" },\n' |
| 730 ']') | 730 ']') |
| 731 write( | 731 write( |
| 732 os.path.join('foo', 'DEPS'), | 732 os.path.join('foo', 'DEPS'), |
| 733 'use_relative_paths = True\n' | 733 'use_relative_paths = True\n' |
| 734 'deps = {\n' | 734 'deps = {\n' |
| 735 ' "bar": "/bar",\n' | 735 ' "bar": "/bar",\n' |
| 736 '}\n' | 736 '}\n' |
| 737 'recursedeps = {"bar"}') | 737 'recursedeps = ["bar"]') |
| 738 write( | 738 write( |
| 739 os.path.join('bar', 'DEPS'), | 739 os.path.join('bar', 'DEPS'), |
| 740 'deps = {\n' | 740 'deps = {\n' |
| 741 ' "baz": "/baz",\n' | 741 ' "baz": "/baz",\n' |
| 742 '}') | 742 '}') |
| 743 write( | 743 write( |
| 744 os.path.join('baz', 'DEPS'), | 744 os.path.join('baz', 'DEPS'), |
| 745 'deps = {\n' | 745 'deps = {\n' |
| 746 ' "fizz": "/fizz",\n' | 746 ' "fizz": "/fizz",\n' |
| 747 '}') | 747 '}') |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 'solutions = [\n' | 799 'solutions = [\n' |
| 800 ' { "name": "foo", "url": "svn://example.com/foo" },\n' | 800 ' { "name": "foo", "url": "svn://example.com/foo" },\n' |
| 801 ' { "name": "foo/bar", "url": "svn://example.com/bar" },\n' | 801 ' { "name": "foo/bar", "url": "svn://example.com/bar" },\n' |
| 802 ']') | 802 ']') |
| 803 write( | 803 write( |
| 804 os.path.join('foo', 'DEPS'), | 804 os.path.join('foo', 'DEPS'), |
| 805 'deps = {\n' | 805 'deps = {\n' |
| 806 ' "bar": "/bar",\n' | 806 ' "bar": "/bar",\n' |
| 807 '}\n' | 807 '}\n' |
| 808 'recursion = 3\n' | 808 'recursion = 3\n' |
| 809 'recursedeps = {"bar"}') | 809 'recursedeps = ["bar"]') |
| 810 write( | 810 write( |
| 811 os.path.join('bar', 'DEPS'), | 811 os.path.join('bar', 'DEPS'), |
| 812 'deps = {\n' | 812 'deps = {\n' |
| 813 ' "baz": "/baz",\n' | 813 ' "baz": "/baz",\n' |
| 814 '}') | 814 '}') |
| 815 write( | 815 write( |
| 816 os.path.join('baz', 'DEPS'), | 816 os.path.join('baz', 'DEPS'), |
| 817 'deps = {\n' | 817 'deps = {\n' |
| 818 ' "fizz": "/fizz",\n' | 818 ' "fizz": "/fizz",\n' |
| 819 '}') | 819 '}') |
| 820 write( | 820 write( |
| 821 os.path.join('fizz', 'DEPS'), | 821 os.path.join('fizz', 'DEPS'), |
| 822 'deps = {\n' | 822 'deps = {\n' |
| 823 ' "fuzz": "/fuzz",\n' | 823 ' "fuzz": "/fuzz",\n' |
| 824 '}\n' | 824 '}\n' |
| 825 'recursedeps = {"fuzz"}') | 825 'recursedeps = ["fuzz"]') |
| 826 write( | 826 write( |
| 827 os.path.join('fuzz', 'DEPS'), | 827 os.path.join('fuzz', 'DEPS'), |
| 828 'deps = {\n' | 828 'deps = {\n' |
| 829 ' "tar": "/tar",\n' | 829 ' "tar": "/tar",\n' |
| 830 '}') | 830 '}') |
| 831 | 831 |
| 832 options, _ = gclient.OptionParser().parse_args([]) | 832 options, _ = gclient.OptionParser().parse_args([]) |
| 833 obj = gclient.GClient.LoadCurrentConfig(options) | 833 obj = gclient.GClient.LoadCurrentConfig(options) |
| 834 obj.RunOnDeps('None', []) | 834 obj.RunOnDeps('None', []) |
| 835 self.assertEquals( | 835 self.assertEquals( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 912 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
| 913 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) | 913 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) |
| 914 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) | 914 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) |
| 915 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) | 915 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) |
| 916 logging.basicConfig( | 916 logging.basicConfig( |
| 917 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 917 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
| 918 min(sys.argv.count('-v'), 3)], | 918 min(sys.argv.count('-v'), 3)], |
| 919 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' | 919 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' |
| 920 '%(lineno)d) %(message)s') | 920 '%(lineno)d) %(message)s') |
| 921 unittest.main() | 921 unittest.main() |
| OLD | NEW |