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

Side by Side Diff: tests/gclient_test.py

Issue 546022: gclient: git relative url implementation (Closed)
Patch Set: Created 10 years, 11 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
« no previous file with comments | « tests/gclient_scm_test.py ('k') | tests/gclient_utils_test.py » ('j') | 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/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright 2008-2009 Google Inc. All Rights Reserved. 3 # Copyright 2008-2009 Google Inc. All Rights Reserved.
4 # 4 #
5 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License. 6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at 7 # You may obtain a copy of the License at
8 # 8 #
9 # http://www.apache.org/licenses/LICENSE-2.0 9 # http://www.apache.org/licenses/LICENSE-2.0
10 # 10 #
(...skipping 29 matching lines...) Expand all
40 def Options(self, *args, **kwargs): 40 def Options(self, *args, **kwargs):
41 return self.OptionsObject(self, *args, **kwargs) 41 return self.OptionsObject(self, *args, **kwargs)
42 42
43 def setUp(self): 43 def setUp(self):
44 BaseTestCase.setUp(self) 44 BaseTestCase.setUp(self)
45 # These are not tested. 45 # These are not tested.
46 self.mox.StubOutWithMock(gclient.gclient_utils, 'FileRead') 46 self.mox.StubOutWithMock(gclient.gclient_utils, 'FileRead')
47 self.mox.StubOutWithMock(gclient.gclient_utils, 'FileWrite') 47 self.mox.StubOutWithMock(gclient.gclient_utils, 'FileWrite')
48 self.mox.StubOutWithMock(gclient.gclient_utils, 'SubprocessCall') 48 self.mox.StubOutWithMock(gclient.gclient_utils, 'SubprocessCall')
49 self.mox.StubOutWithMock(gclient.gclient_utils, 'RemoveDirectory') 49 self.mox.StubOutWithMock(gclient.gclient_utils, 'RemoveDirectory')
50 self.mox.StubOutWithMock(gclient.gclient_utils, 'FullUrlFromRelative')
51 # Mock them to be sure nothing bad happens. 50 # Mock them to be sure nothing bad happens.
52 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Capture') 51 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Capture')
53 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureInfo') 52 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureInfo')
54 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureStatus') 53 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureStatus')
55 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Run') 54 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Run')
56 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'RunAndGetFileList') 55 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'RunAndGetFileList')
57 self._gclient_gclient = gclient.GClient 56 self._gclient_gclient = gclient.GClient
58 gclient.GClient = self.mox.CreateMockAnything() 57 gclient.GClient = self.mox.CreateMockAnything()
59 self._scm_wrapper = gclient.gclient_scm.CreateSCM 58 self._scm_wrapper = gclient.gclient_scm.CreateSCM
60 gclient.gclient_scm.CreateSCM = self.mox.CreateMockAnything() 59 gclient.gclient_scm.CreateSCM = self.mox.CreateMockAnything()
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 gclient.os.path.join(self.root_dir, 'src/breakpad/bar', '.git') 790 gclient.os.path.join(self.root_dir, 'src/breakpad/bar', '.git')
792 ).AndReturn(False) 791 ).AndReturn(False)
793 gclient.os.path.exists( 792 gclient.os.path.exists(
794 gclient.os.path.join(self.root_dir, options.entries_filename) 793 gclient.os.path.join(self.root_dir, options.entries_filename)
795 ).AndReturn(False) 794 ).AndReturn(False)
796 795
797 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 'src').AndReturn( 796 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 'src').AndReturn(
798 scm_wrapper_src) 797 scm_wrapper_src)
799 scm_wrapper_src.RunCommand('update', mox.Func(OptIsRev123), self.args, []) 798 scm_wrapper_src.RunCommand('update', mox.Func(OptIsRev123), self.args, [])
800 799
801 gclient.gclient_utils.FullUrlFromRelative(self.url, 800 gclient.gclient_scm.CreateSCM(self.url, self.root_dir,
802 '/trunk/deps/third_party/cygwin@32 48' 801 None).AndReturn(scm_wrapper_src2)
803 ).AndReturn(cygwin_path) 802 scm_wrapper_src2.FullUrlForRelativeUrl('/trunk/deps/third_party/cygwin@3248'
803 ).AndReturn(cygwin_path)
804 804
805 gclient.gclient_utils.FullUrlFromRelative(self.url, 805 gclient.gclient_scm.CreateSCM(self.url, self.root_dir,
806 '/trunk/deps/third_party/WebKit' 806 None).AndReturn(scm_wrapper_src2)
807 ).AndReturn(webkit_path) 807 scm_wrapper_src2.FullUrlForRelativeUrl('/trunk/deps/third_party/WebKit'
808 ).AndReturn(webkit_path)
808 809
809 gclient.gclient_scm.CreateSCM( 810 gclient.gclient_scm.CreateSCM(
810 webkit_path, self.root_dir, 'foo/third_party/WebKit' 811 webkit_path, self.root_dir, 'foo/third_party/WebKit'
811 ).AndReturn(scm_wrapper_webkit) 812 ).AndReturn(scm_wrapper_webkit)
812 scm_wrapper_webkit.RunCommand('update', mox.Func(OptIsRev42), self.args, []) 813 scm_wrapper_webkit.RunCommand('update', mox.Func(OptIsRev42), self.args, [])
813 814
814 gclient.gclient_scm.CreateSCM( 815 gclient.gclient_scm.CreateSCM(
815 'http://google-breakpad.googlecode.com/svn/trunk/src@285', 816 'http://google-breakpad.googlecode.com/svn/trunk/src@285',
816 self.root_dir, 'src/breakpad/bar').AndReturn(scm_wrapper_breakpad) 817 self.root_dir, 'src/breakpad/bar').AndReturn(scm_wrapper_breakpad)
817 scm_wrapper_breakpad.RunCommand('update', mox.Func(OptIsRevNone), 818 scm_wrapper_breakpad.RunCommand('update', mox.Func(OptIsRevNone),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 gclient.os.path.exists( 906 gclient.os.path.exists(
906 gclient.os.path.join(self.root_dir, name, '.git') 907 gclient.os.path.join(self.root_dir, name, '.git')
907 ).AndReturn(False) 908 ).AndReturn(False)
908 gclient.os.path.exists( 909 gclient.os.path.exists(
909 gclient.os.path.join(self.root_dir, options.entries_filename) 910 gclient.os.path.join(self.root_dir, options.entries_filename)
910 ).AndReturn(False) 911 ).AndReturn(False)
911 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn( 912 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn(
912 gclient.gclient_scm.CreateSCM) 913 gclient.gclient_scm.CreateSCM)
913 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 914 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
914 915
915 gclient.gclient_utils.FullUrlFromRelative(self.url, 916 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, None
916 '/trunk/bar/WebKit', 917 ).AndReturn(scm_wrapper_src)
917 ).AndReturn(webkit_path) 918 scm_wrapper_src.FullUrlForRelativeUrl('/trunk/bar/WebKit'
919 ).AndReturn(webkit_path)
918 920
919 gclient.gclient_scm.CreateSCM( 921 gclient.gclient_scm.CreateSCM(
920 webkit_path, self.root_dir, 'foo/third_party/WebKit' 922 webkit_path, self.root_dir, 'foo/third_party/WebKit'
921 ).AndReturn(gclient.gclient_scm.CreateSCM) 923 ).AndReturn(gclient.gclient_scm.CreateSCM)
922 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 924 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
923 925
924 self.mox.ReplayAll() 926 self.mox.ReplayAll()
925 client = self._gclient_gclient(self.root_dir, options) 927 client = self._gclient_gclient(self.root_dir, options)
926 client.SetConfig(gclient_config) 928 client.SetConfig(gclient_config)
927 client.RunOnDeps('update', self.args) 929 client.RunOnDeps('update', self.args)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 gclient.os.path.exists( 970 gclient.os.path.exists(
969 gclient.os.path.join(self.root_dir, name, '.git') 971 gclient.os.path.join(self.root_dir, name, '.git')
970 ).AndReturn(False) 972 ).AndReturn(False)
971 gclient.os.path.exists( 973 gclient.os.path.exists(
972 gclient.os.path.join(self.root_dir, options.entries_filename) 974 gclient.os.path.join(self.root_dir, options.entries_filename)
973 ).AndReturn(False) 975 ).AndReturn(False)
974 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn( 976 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn(
975 gclient.gclient_scm.CreateSCM) 977 gclient.gclient_scm.CreateSCM)
976 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 978 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
977 979
978 gclient.gclient_utils.FullUrlFromRelative(self.url, 980 gclient.gclient_scm.CreateSCM(self.url, self.root_dir,
979 '/trunk/bar_custom/WebKit' 981 None).AndReturn(scm_wrapper_src)
980 ).AndReturn(webkit_path) 982 scm_wrapper_src.FullUrlForRelativeUrl('/trunk/bar_custom/WebKit'
983 ).AndReturn(webkit_path)
981 984
982 gclient.gclient_scm.CreateSCM(webkit_path, self.root_dir, 985 gclient.gclient_scm.CreateSCM(webkit_path, self.root_dir,
983 'foo/third_party/WebKit').AndReturn(gclient.gclient_scm.CreateSCM) 986 'foo/third_party/WebKit').AndReturn(gclient.gclient_scm.CreateSCM)
984 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 987 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
985 988
986 self.mox.ReplayAll() 989 self.mox.ReplayAll()
987 client = self._gclient_gclient(self.root_dir, options) 990 client = self._gclient_gclient(self.root_dir, options)
988 client.SetConfig(gclient_config) 991 client.SetConfig(gclient_config)
989 client.RunOnDeps('update', self.args) 992 client.RunOnDeps('update', self.args)
990 993
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 pass 1064 pass
1062 def test_VarImpl(self): 1065 def test_VarImpl(self):
1063 pass 1066 pass
1064 1067
1065 1068
1066 if __name__ == '__main__': 1069 if __name__ == '__main__':
1067 import unittest 1070 import unittest
1068 unittest.main() 1071 unittest.main()
1069 1072
1070 # vim: ts=2:sw=2:tw=80:et: 1073 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « tests/gclient_scm_test.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698