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

Side by Side Diff: tests/gclient_scm_test.py

Issue 8359018: Fix a concurrency issue happening with deep dependencies when the intermediary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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
« no previous file with comments | « gclient_utils.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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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_scm.py.""" 6 """Unit tests for gclient_scm.py."""
7 7
8 # pylint: disable=E1101,E1103,W0403 8 # pylint: disable=E1101,E1103,W0403
9 9
10 # Import before super_mox to keep valid references. 10 # Import before super_mox to keep valid references.
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 options = self.Options(verbose=True) 135 options = self.Options(verbose=True)
136 gclient_scm.os.path.isdir(self.base_path).AndReturn(False) 136 gclient_scm.os.path.isdir(self.base_path).AndReturn(False)
137 gclient_scm.os.path.exists(self.base_path).AndReturn(False) 137 gclient_scm.os.path.exists(self.base_path).AndReturn(False)
138 gclient_scm.scm.SVN.Capture(['--version'] 138 gclient_scm.scm.SVN.Capture(['--version']
139 ).AndReturn('svn, version 1.5.1 (r32289)') 139 ).AndReturn('svn, version 1.5.1 (r32289)')
140 # It'll to a checkout instead. 140 # It'll to a checkout instead.
141 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) 141 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
142 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) 142 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
143 # Checkout. 143 # Checkout.
144 gclient_scm.os.path.exists(self.base_path).AndReturn(False) 144 gclient_scm.os.path.exists(self.base_path).AndReturn(False)
145 parent = gclient_scm.os.path.dirname(self.base_path)
146 gclient_scm.os.path.exists(parent).AndReturn(False)
147 gclient_scm.os.makedirs(parent)
148 gclient_scm.os.path.exists(parent).AndReturn(True)
145 files_list = self.mox.CreateMockAnything() 149 files_list = self.mox.CreateMockAnything()
146 gclient_scm.scm.SVN.RunAndGetFileList( 150 gclient_scm.scm.SVN.RunAndGetFileList(
147 options.verbose, 151 options.verbose,
148 ['checkout', self.url, self.base_path, '--force', '--ignore-externals'], 152 ['checkout', self.url, self.base_path, '--force', '--ignore-externals'],
149 cwd=self.root_dir, 153 cwd=self.root_dir,
150 file_list=files_list) 154 file_list=files_list)
151 155
152 self.mox.ReplayAll() 156 self.mox.ReplayAll()
153 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 157 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
154 relpath=self.relpath) 158 relpath=self.relpath)
155 scm.revert(options, self.args, files_list) 159 scm.revert(options, self.args, files_list)
156 self.checkstdout( 160 self.checkstdout(
157 ('\n_____ %s is missing, synching instead\n' % self.relpath)) 161 ('\n_____ %s is missing, synching instead\n' % self.relpath))
158 162
159 def testRevertNoDotSvn(self): 163 def testRevertNoDotSvn(self):
160 options = self.Options(verbose=True, force=True) 164 options = self.Options(verbose=True, force=True)
161 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 165 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
162 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(False) 166 gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(False)
163 gclient_scm.os.path.isdir(join(self.base_path, '.git')).AndReturn(False) 167 gclient_scm.os.path.isdir(join(self.base_path, '.git')).AndReturn(False)
164 gclient_scm.os.path.isdir(join(self.base_path, '.hg')).AndReturn(False) 168 gclient_scm.os.path.isdir(join(self.base_path, '.hg')).AndReturn(False)
165 # Checkout. 169 # Checkout.
166 gclient_scm.os.path.exists(self.base_path).AndReturn(False) 170 gclient_scm.os.path.exists(self.base_path).AndReturn(False)
167 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) 171 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
168 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) 172 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
169 gclient_scm.os.path.exists(self.base_path).AndReturn(False) 173 gclient_scm.os.path.exists(self.base_path).AndReturn(False)
174 parent = gclient_scm.os.path.dirname(self.base_path)
175 gclient_scm.os.path.exists(parent).AndReturn(False)
176 gclient_scm.os.makedirs(parent)
177 gclient_scm.os.path.exists(parent).AndReturn(True)
170 files_list = self.mox.CreateMockAnything() 178 files_list = self.mox.CreateMockAnything()
171 gclient_scm.scm.SVN.Capture(['--version']).AndReturn('svn, version 1.6') 179 gclient_scm.scm.SVN.Capture(['--version']).AndReturn('svn, version 1.6')
172 gclient_scm.scm.SVN.RunAndGetFileList( 180 gclient_scm.scm.SVN.RunAndGetFileList(
173 options.verbose, 181 options.verbose,
174 ['checkout', self.url, self.base_path, '--force', '--ignore-externals'], 182 ['checkout', self.url, self.base_path, '--force', '--ignore-externals'],
175 cwd=self.root_dir, 183 cwd=self.root_dir,
176 file_list=files_list) 184 file_list=files_list)
177 185
178 self.mox.ReplayAll() 186 self.mox.ReplayAll()
179 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 187 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 options = self.Options(verbose=True) 256 options = self.Options(verbose=True)
249 file_info = gclient_scm.gclient_utils.PrintableObject() 257 file_info = gclient_scm.gclient_utils.PrintableObject()
250 file_info.root = 'blah' 258 file_info.root = 'blah'
251 file_info.url = self.url 259 file_info.url = self.url
252 file_info.uuid = 'ABC' 260 file_info.uuid = 'ABC'
253 file_info.revision = 42 261 file_info.revision = 42
254 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) 262 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
255 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) 263 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
256 # Checkout. 264 # Checkout.
257 gclient_scm.os.path.exists(self.base_path).AndReturn(False) 265 gclient_scm.os.path.exists(self.base_path).AndReturn(False)
266 parent = gclient_scm.os.path.dirname(self.base_path)
267 gclient_scm.os.path.exists(parent).AndReturn(False)
268 gclient_scm.os.makedirs(parent)
269 gclient_scm.os.path.exists(parent).AndReturn(True)
258 files_list = self.mox.CreateMockAnything() 270 files_list = self.mox.CreateMockAnything()
259 gclient_scm.scm.SVN.Capture(['--version'] 271 gclient_scm.scm.SVN.Capture(['--version']
260 ).AndReturn('svn, version 1.5.1 (r32289)') 272 ).AndReturn('svn, version 1.5.1 (r32289)')
261 gclient_scm.scm.SVN.RunAndGetFileList( 273 gclient_scm.scm.SVN.RunAndGetFileList(
262 options.verbose, 274 options.verbose,
263 ['checkout', self.url, self.base_path, '--force', '--ignore-externals'], 275 ['checkout', self.url, self.base_path, '--force', '--ignore-externals'],
264 cwd=self.root_dir, 276 cwd=self.root_dir,
265 file_list=files_list) 277 file_list=files_list)
266 self.mox.ReplayAll() 278 self.mox.ReplayAll()
267 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 279 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 933
922 if __name__ == '__main__': 934 if __name__ == '__main__':
923 if '-v' in sys.argv: 935 if '-v' in sys.argv:
924 logging.basicConfig( 936 logging.basicConfig(
925 level=logging.DEBUG, 937 level=logging.DEBUG,
926 format='%(asctime).19s %(levelname)s %(filename)s:' 938 format='%(asctime).19s %(levelname)s %(filename)s:'
927 '%(lineno)s %(message)s') 939 '%(lineno)s %(message)s')
928 unittest.main() 940 unittest.main()
929 941
930 # vim: ts=2:sw=2:tw=80:et: 942 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_utils.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698