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

Side by Side Diff: tests/gclient_test.py

Issue 500015: gclient: implement a less hacky relative URL implementation (Closed)
Patch Set: Created 11 years 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
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')
50 # Mock them to be sure nothing bad happens. 51 # Mock them to be sure nothing bad happens.
51 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Capture') 52 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Capture')
52 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureInfo') 53 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureInfo')
53 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureStatus') 54 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'CaptureStatus')
54 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Run') 55 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'Run')
55 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'RunAndGetFileList') 56 self.mox.StubOutWithMock(gclient.gclient_scm.scm.SVN, 'RunAndGetFileList')
56 self._gclient_gclient = gclient.GClient 57 self._gclient_gclient = gclient.GClient
57 gclient.GClient = self.mox.CreateMockAnything() 58 gclient.GClient = self.mox.CreateMockAnything()
58 self._scm_wrapper = gclient.gclient_scm.CreateSCM 59 self._scm_wrapper = gclient.gclient_scm.CreateSCM
59 gclient.gclient_scm.CreateSCM = self.mox.CreateMockAnything() 60 gclient.gclient_scm.CreateSCM = self.mox.CreateMockAnything()
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 gclient.os.path.join(self.root_dir, 'src/breakpad/bar', '.git') 791 gclient.os.path.join(self.root_dir, 'src/breakpad/bar', '.git')
791 ).AndReturn(False) 792 ).AndReturn(False)
792 gclient.os.path.exists( 793 gclient.os.path.exists(
793 gclient.os.path.join(self.root_dir, options.entries_filename) 794 gclient.os.path.join(self.root_dir, options.entries_filename)
794 ).AndReturn(False) 795 ).AndReturn(False)
795 796
796 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 'src').AndReturn( 797 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 'src').AndReturn(
797 scm_wrapper_src) 798 scm_wrapper_src)
798 scm_wrapper_src.RunCommand('update', mox.Func(OptIsRev123), self.args, []) 799 scm_wrapper_src.RunCommand('update', mox.Func(OptIsRev123), self.args, [])
799 800
800 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 801 gclient.gclient_utils.FullUrlFromRelative(self.url,
801 None).AndReturn(scm_wrapper_src2) 802 '/trunk/deps/third_party/cygwin@32 48'
M-A Ruel 2009/12/15 18:49:42 80 cols
802 scm_wrapper_src2.FullUrlForRelativeUrl('/trunk/deps/third_party/cygwin@3248' 803 ).AndReturn(cygwin_path)
803 ).AndReturn(cygwin_path)
804 804
805 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 805 gclient.gclient_utils.FullUrlFromRelative(self.url,
806 None).AndReturn(scm_wrapper_src2) 806 '/trunk/deps/third_party/WebKit'
807 scm_wrapper_src2.FullUrlForRelativeUrl('/trunk/deps/third_party/WebKit' 807 ).AndReturn(webkit_path)
808 ).AndReturn(webkit_path)
809 808
810 gclient.gclient_scm.CreateSCM( 809 gclient.gclient_scm.CreateSCM(
811 webkit_path, self.root_dir, 'foo/third_party/WebKit' 810 webkit_path, self.root_dir, 'foo/third_party/WebKit'
812 ).AndReturn(scm_wrapper_webkit) 811 ).AndReturn(scm_wrapper_webkit)
813 scm_wrapper_webkit.RunCommand('update', mox.Func(OptIsRev42), self.args, []) 812 scm_wrapper_webkit.RunCommand('update', mox.Func(OptIsRev42), self.args, [])
814 813
815 gclient.gclient_scm.CreateSCM( 814 gclient.gclient_scm.CreateSCM(
816 'http://google-breakpad.googlecode.com/svn/trunk/src@285', 815 'http://google-breakpad.googlecode.com/svn/trunk/src@285',
817 self.root_dir, 'src/breakpad/bar').AndReturn(scm_wrapper_breakpad) 816 self.root_dir, 'src/breakpad/bar').AndReturn(scm_wrapper_breakpad)
818 scm_wrapper_breakpad.RunCommand('update', mox.Func(OptIsRevNone), 817 scm_wrapper_breakpad.RunCommand('update', mox.Func(OptIsRevNone),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 gclient.os.path.exists( 905 gclient.os.path.exists(
907 gclient.os.path.join(self.root_dir, name, '.git') 906 gclient.os.path.join(self.root_dir, name, '.git')
908 ).AndReturn(False) 907 ).AndReturn(False)
909 gclient.os.path.exists( 908 gclient.os.path.exists(
910 gclient.os.path.join(self.root_dir, options.entries_filename) 909 gclient.os.path.join(self.root_dir, options.entries_filename)
911 ).AndReturn(False) 910 ).AndReturn(False)
912 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn( 911 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn(
913 gclient.gclient_scm.CreateSCM) 912 gclient.gclient_scm.CreateSCM)
914 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 913 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
915 914
916 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, None 915 gclient.gclient_utils.FullUrlFromRelative(self.url,
917 ).AndReturn(scm_wrapper_src) 916 '/trunk/bar/WebKit',
918 scm_wrapper_src.FullUrlForRelativeUrl('/trunk/bar/WebKit' 917 ).AndReturn(webkit_path)
919 ).AndReturn(webkit_path)
920 918
921 gclient.gclient_scm.CreateSCM( 919 gclient.gclient_scm.CreateSCM(
922 webkit_path, self.root_dir, 'foo/third_party/WebKit' 920 webkit_path, self.root_dir, 'foo/third_party/WebKit'
923 ).AndReturn(gclient.gclient_scm.CreateSCM) 921 ).AndReturn(gclient.gclient_scm.CreateSCM)
924 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 922 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
925 923
926 self.mox.ReplayAll() 924 self.mox.ReplayAll()
927 client = self._gclient_gclient(self.root_dir, options) 925 client = self._gclient_gclient(self.root_dir, options)
928 client.SetConfig(gclient_config) 926 client.SetConfig(gclient_config)
929 client.RunOnDeps('update', self.args) 927 client.RunOnDeps('update', self.args)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 gclient.os.path.exists( 968 gclient.os.path.exists(
971 gclient.os.path.join(self.root_dir, name, '.git') 969 gclient.os.path.join(self.root_dir, name, '.git')
972 ).AndReturn(False) 970 ).AndReturn(False)
973 gclient.os.path.exists( 971 gclient.os.path.exists(
974 gclient.os.path.join(self.root_dir, options.entries_filename) 972 gclient.os.path.join(self.root_dir, options.entries_filename)
975 ).AndReturn(False) 973 ).AndReturn(False)
976 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn( 974 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, name).AndReturn(
977 gclient.gclient_scm.CreateSCM) 975 gclient.gclient_scm.CreateSCM)
978 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 976 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
979 977
980 gclient.gclient_scm.CreateSCM(self.url, self.root_dir, 978 gclient.gclient_utils.FullUrlFromRelative(self.url,
981 None).AndReturn(scm_wrapper_src) 979 '/trunk/bar_custom/WebKit'
982 scm_wrapper_src.FullUrlForRelativeUrl('/trunk/bar_custom/WebKit' 980 ).AndReturn(webkit_path)
983 ).AndReturn(webkit_path)
984 981
985 gclient.gclient_scm.CreateSCM(webkit_path, self.root_dir, 982 gclient.gclient_scm.CreateSCM(webkit_path, self.root_dir,
986 'foo/third_party/WebKit').AndReturn(gclient.gclient_scm.CreateSCM) 983 'foo/third_party/WebKit').AndReturn(gclient.gclient_scm.CreateSCM)
987 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, []) 984 gclient.gclient_scm.CreateSCM.RunCommand('update', options, self.args, [])
988 985
989 self.mox.ReplayAll() 986 self.mox.ReplayAll()
990 client = self._gclient_gclient(self.root_dir, options) 987 client = self._gclient_gclient(self.root_dir, options)
991 client.SetConfig(gclient_config) 988 client.SetConfig(gclient_config)
992 client.RunOnDeps('update', self.args) 989 client.RunOnDeps('update', self.args)
993 990
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 pass 1061 pass
1065 def test_VarImpl(self): 1062 def test_VarImpl(self):
1066 pass 1063 pass
1067 1064
1068 1065
1069 if __name__ == '__main__': 1066 if __name__ == '__main__':
1070 import unittest 1067 import unittest
1071 unittest.main() 1068 unittest.main()
1072 1069
1073 # vim: ts=2:sw=2:tw=80:et: 1070 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« gclient_utils.py ('K') | « 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