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

Side by Side Diff: tests/gclient_test.py

Issue 1948853002: Reland: Add ability to override DEPS file in recursedeps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Fix SVN regression bug Created 4 years, 7 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
« gclient.py ('K') | « 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) 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 # Deps after this would have been skipped if we were obeying 840 # Deps after this would have been skipped if we were obeying
841 # |recursedeps|. 841 # |recursedeps|.
842 'svn://example.com/foo/bar/baz', 842 'svn://example.com/foo/bar/baz',
843 'svn://example.com/foo/bar/baz/fizz', 843 'svn://example.com/foo/bar/baz/fizz',
844 # And this dep would have been picked up if we were obeying 844 # And this dep would have been picked up if we were obeying
845 # |recursedeps|. 845 # |recursedeps|.
846 # 'svn://example.com/foo/bar/baz/fuzz', 846 # 'svn://example.com/foo/bar/baz/fuzz',
847 ], 847 ],
848 self._get_processed()) 848 self._get_processed())
849 849
850 def testRecursedepsAltfile(self):
851 """Verifies gclient respects the |recursedeps| var syntax with overridden
852 target DEPS file.
853
854 This is what we mean to check here:
855 - Naming an alternate DEPS file in recursedeps pulls from that one.
856 """
857 write(
858 '.gclient',
859 'solutions = [\n'
860 ' { "name": "foo", "url": "svn://example.com/foo" },\n'
861 ']')
862 write(
863 os.path.join('foo', 'DEPS'),
864 'deps = {\n'
865 ' "bar": "/bar",\n'
866 '}\n'
867 'recursedeps = [("bar", "DEPS.alt")]')
868 write(os.path.join('bar', 'DEPS'), 'ERROR ERROR ERROR')
869 write(
870 os.path.join('bar', 'DEPS.alt'),
871 'deps = {\n'
872 ' "baz": "/baz",\n'
873 '}')
874
875 options, _ = gclient.OptionParser().parse_args([])
876 obj = gclient.GClient.LoadCurrentConfig(options)
877 obj.RunOnDeps('None', [])
878 self.assertEquals(
879 [
880 'svn://example.com/foo',
881 'svn://example.com/foo/bar',
882 'svn://example.com/foo/bar/baz',
883 ],
884 self._get_processed())
885
850 def testGitDeps(self): 886 def testGitDeps(self):
851 """Verifies gclient respects a .DEPS.git deps file. 887 """Verifies gclient respects a .DEPS.git deps file.
852 888
853 Along the way, we also test that if both DEPS and .DEPS.git are present, 889 Along the way, we also test that if both DEPS and .DEPS.git are present,
854 that gclient does not read the DEPS file. This will reliably catch bugs 890 that gclient does not read the DEPS file. This will reliably catch bugs
855 where gclient is always hitting the wrong file (DEPS). 891 where gclient is always hitting the wrong file (DEPS).
856 """ 892 """
857 write( 893 write(
858 '.gclient', 894 '.gclient',
859 'solutions = [\n' 895 'solutions = [\n'
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) 1066 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
1031 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) 1067 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
1032 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) 1068 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
1033 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) 1069 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
1034 logging.basicConfig( 1070 logging.basicConfig(
1035 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ 1071 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
1036 min(sys.argv.count('-v'), 3)], 1072 min(sys.argv.count('-v'), 3)],
1037 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' 1073 format='%(relativeCreated)4d %(levelname)5s %(module)13s('
1038 '%(lineno)d) %(message)s') 1074 '%(lineno)d) %(message)s')
1039 unittest.main() 1075 unittest.main()
OLDNEW
« gclient.py ('K') | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698