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

Side by Side Diff: tests/gclient_test.py

Issue 368713002: Add fallback to DEPS from a missing deps file. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 5 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
« 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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 # Deps after this would have been skipped if we were obeying 802 # Deps after this would have been skipped if we were obeying
803 # |recurselist|. 803 # |recurselist|.
804 'svn://example.com/foo/bar/baz', 804 'svn://example.com/foo/bar/baz',
805 'svn://example.com/foo/bar/baz/fizz', 805 'svn://example.com/foo/bar/baz/fizz',
806 # And this dep would have been picked up if we were obeying 806 # And this dep would have been picked up if we were obeying
807 # |recurselist|. 807 # |recurselist|.
808 # 'svn://example.com/foo/bar/baz/fuzz', 808 # 'svn://example.com/foo/bar/baz/fuzz',
809 ], 809 ],
810 self._get_processed()) 810 self._get_processed())
811 811
812 def testGitDeps(self):
813 """Verifies gclient respects fallback to DEPS."""
iannucci 2014/07/01 22:04:08 docstring is off.
cmp 2014/07/01 22:11:50 Fixed in a version I uploaded earlier.
814 write(
815 '.gclient',
816 'solutions = [\n'
817 ' { "name": "foo", "url": "svn://example.com/foo",\n'
818 ' "deps_file" : ".DEPS.git",\n'
819 ' },\n'
820 ']')
821 write(
822 os.path.join('foo', '.DEPS.git'),
823 'deps = {\n'
824 ' "bar": "/bar",\n'
825 '}')
826
827 options, _ = gclient.OptionParser().parse_args([])
828 obj = gclient.GClient.LoadCurrentConfig(options)
829 obj.RunOnDeps('None', [])
830 self.assertEquals(
831 [
832 'svn://example.com/foo',
833 'svn://example.com/foo/bar',
834 ],
835 self._get_processed())
836
837 def testGitDepsFallback(self):
838 """Verifies gclient respects fallback to DEPS."""
839 write(
840 '.gclient',
841 'solutions = [\n'
842 ' { "name": "foo", "url": "svn://example.com/foo",\n'
843 ' "deps_file" : ".DEPS.git",\n'
844 ' },\n'
845 ']')
846 write(
847 os.path.join('foo', 'DEPS'),
848 'deps = {\n'
849 ' "bar": "/bar",\n'
850 '}')
851
852 options, _ = gclient.OptionParser().parse_args([])
853 obj = gclient.GClient.LoadCurrentConfig(options)
854 obj.RunOnDeps('None', [])
855 self.assertEquals(
856 [
857 'svn://example.com/foo',
858 'svn://example.com/foo/bar',
859 ],
860 self._get_processed())
861
812 862
813 if __name__ == '__main__': 863 if __name__ == '__main__':
814 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) 864 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
815 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True) 865 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
816 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr) 866 sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
817 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True) 867 sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
818 logging.basicConfig( 868 logging.basicConfig(
819 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ 869 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
820 min(sys.argv.count('-v'), 3)], 870 min(sys.argv.count('-v'), 3)],
821 format='%(relativeCreated)4d %(levelname)5s %(module)13s(' 871 format='%(relativeCreated)4d %(levelname)5s %(module)13s('
822 '%(lineno)d) %(message)s') 872 '%(lineno)d) %(message)s')
823 unittest.main() 873 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