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

Side by Side Diff: tests/gclient_test.py

Issue 155759: Add a --nohooks to gclient to update/sync/revert without calling the hooks (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 11 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 | 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/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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 gclient.GClient = self._gclient_gclient 73 gclient.GClient = self._gclient_gclient
74 gclient.SCMWrapper = self._scm_wrapper 74 gclient.SCMWrapper = self._scm_wrapper
75 BaseTestCase.tearDown(self) 75 BaseTestCase.tearDown(self)
76 76
77 77
78 class GclientTestCase(GClientBaseTestCase): 78 class GclientTestCase(GClientBaseTestCase):
79 class OptionsObject(object): 79 class OptionsObject(object):
80 def __init__(self, test_case, verbose=False, spec=None, 80 def __init__(self, test_case, verbose=False, spec=None,
81 config_filename='a_file_name', 81 config_filename='a_file_name',
82 entries_filename='a_entry_file_name', 82 entries_filename='a_entry_file_name',
83 deps_file='a_deps_file_name', force=False): 83 deps_file='a_deps_file_name', force=False, nohooks=False):
84 self.verbose = verbose 84 self.verbose = verbose
85 self.spec = spec 85 self.spec = spec
86 self.config_filename = config_filename 86 self.config_filename = config_filename
87 self.entries_filename = entries_filename 87 self.entries_filename = entries_filename
88 self.deps_file = deps_file 88 self.deps_file = deps_file
89 self.force = force 89 self.force = force
90 self.nohooks = nohooks
90 self.revisions = [] 91 self.revisions = []
91 self.manually_grab_svn_rev = True 92 self.manually_grab_svn_rev = True
92 self.deps_os = None 93 self.deps_os = None
93 self.head = False 94 self.head = False
94 95
95 # Mox 96 # Mox
96 self.platform = test_case.platform 97 self.platform = test_case.platform
97 98
98 def setUp(self): 99 def setUp(self):
99 GClientBaseTestCase.setUp(self) 100 GClientBaseTestCase.setUp(self)
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1001
1001 1002
1002 class SCMWrapperTestCase(GClientBaseTestCase): 1003 class SCMWrapperTestCase(GClientBaseTestCase):
1003 class OptionsObject(object): 1004 class OptionsObject(object):
1004 def __init__(self, test_case, verbose=False, revision=None): 1005 def __init__(self, test_case, verbose=False, revision=None):
1005 self.verbose = verbose 1006 self.verbose = verbose
1006 self.revision = revision 1007 self.revision = revision
1007 self.manually_grab_svn_rev = True 1008 self.manually_grab_svn_rev = True
1008 self.deps_os = None 1009 self.deps_os = None
1009 self.force = False 1010 self.force = False
1011 self.nohooks = False
1010 1012
1011 def setUp(self): 1013 def setUp(self):
1012 GClientBaseTestCase.setUp(self) 1014 GClientBaseTestCase.setUp(self)
1013 self.root_dir = self.Dir() 1015 self.root_dir = self.Dir()
1014 self.args = self.Args() 1016 self.args = self.Args()
1015 self.url = self.Url() 1017 self.url = self.Url()
1016 self.relpath = 'asf' 1018 self.relpath = 'asf'
1017 1019
1018 def testDir(self): 1020 def testDir(self):
1019 members = [ 1021 members = [
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 self.root_dir, files_list) 1132 self.root_dir, files_list)
1131 self.mox.ReplayAll() 1133 self.mox.ReplayAll()
1132 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1134 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
1133 relpath=self.relpath) 1135 relpath=self.relpath)
1134 scm.update(options, (), files_list) 1136 scm.update(options, (), files_list)
1135 1137
1136 def testUpdateUpdate(self): 1138 def testUpdateUpdate(self):
1137 options = self.Options(verbose=True) 1139 options = self.Options(verbose=True)
1138 base_path = os.path.join(self.root_dir, self.relpath) 1140 base_path = os.path.join(self.root_dir, self.relpath)
1139 options.force = True 1141 options.force = True
1142 options.nohooks = False
1140 file_info = { 1143 file_info = {
1141 'Repository Root': 'blah', 1144 'Repository Root': 'blah',
1142 'URL': self.url, 1145 'URL': self.url,
1143 'UUID': 'ABC', 1146 'UUID': 'ABC',
1144 'Revision': 42, 1147 'Revision': 42,
1145 } 1148 }
1146 gclient.os.path.exists(os.path.join(base_path, '.git')).AndReturn(False) 1149 gclient.os.path.exists(os.path.join(base_path, '.git')).AndReturn(False)
1147 # Checkout or update. 1150 # Checkout or update.
1148 gclient.os.path.exists(base_path).AndReturn(True) 1151 gclient.os.path.exists(base_path).AndReturn(True)
1149 gclient.CaptureSVNInfo(os.path.join(base_path, "."), '.' 1152 gclient.CaptureSVNInfo(os.path.join(base_path, "."), '.'
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 """ 1356 """
1354 gclient.CaptureSVN = CaptureSVNMock 1357 gclient.CaptureSVN = CaptureSVNMock
1355 info = gclient.CaptureSVNStatus(None) 1358 info = gclient.CaptureSVNStatus(None)
1356 self.assertEquals(info, []) 1359 self.assertEquals(info, [])
1357 1360
1358 1361
1359 if __name__ == '__main__': 1362 if __name__ == '__main__':
1360 unittest.main() 1363 unittest.main()
1361 1364
1362 # vim: ts=2:sw=2:tw=80:et: 1365 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« gclient.py ('K') | « gclient.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698