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

Side by Side Diff: tests/gcl_unittest.py

Issue 126031: Add --no_watchlists to some tests to work around unit tests failures. (Closed)
Patch Set: Created 11 years, 6 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 | « no previous file | 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 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 gcl.py.""" 6 """Unit tests for gcl.py."""
7 7
8 import unittest 8 import unittest
9 9
10 # Local imports 10 # Local imports
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 gcl.GetCodeReviewSetting('TRY_ON_UPLOAD').AndReturn('True') 183 gcl.GetCodeReviewSetting('TRY_ON_UPLOAD').AndReturn('True')
184 gcl.TryChange(change_info, [], swallow_exception=True) 184 gcl.TryChange(change_info, [], swallow_exception=True)
185 gcl.os.chdir('somewhere') 185 gcl.os.chdir('somewhere')
186 self.mox.ReplayAll() 186 self.mox.ReplayAll()
187 gcl.UploadCL(change_info, args) 187 gcl.UploadCL(change_info, args)
188 188
189 def testServerOverride(self): 189 def testServerOverride(self):
190 change_info = gcl.ChangeInfo('naame', 0, 0, 'deescription', 190 change_info = gcl.ChangeInfo('naame', 0, 0, 'deescription',
191 ['aa', 'bb']) 191 ['aa', 'bb'])
192 change_info.Save = self.mox.CreateMockAnything() 192 change_info.Save = self.mox.CreateMockAnything()
193 args = ['--server=a'] 193 args = ['--server=a', '--no_watchlists']
194 change_info.Save() 194 change_info.Save()
195 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(True) 195 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(True)
196 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server') 196 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server')
197 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile')) 197 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile'))
198 gcl.os.write(42, change_info.description) 198 gcl.os.write(42, change_info.description)
199 gcl.os.close(42) 199 gcl.os.close(42)
200 gcl.GetCodeReviewSetting('CC_LIST') 200 gcl.GetCodeReviewSetting('CC_LIST')
201 gcl.os.getcwd().AndReturn('somewhere') 201 gcl.os.getcwd().AndReturn('somewhere')
202 gcl.os.chdir(gcl.GetRepositoryRoot().AndReturn(None)) 202 gcl.os.chdir(gcl.GetRepositoryRoot().AndReturn(None))
203 gcl.GenerateDiff(change_info.FileList()) 203 gcl.GenerateDiff(change_info.FileList())
204 gcl.upload.RealMain(['upload.py', '-y', '--server=my_server', '--server=a', 204 gcl.upload.RealMain(['upload.py', '-y', '--server=my_server', '--server=a',
205 "--description_file=descfile", 205 "--description_file=descfile",
206 "--message=deescription"], change_info.patch).AndReturn(("1", "2")) 206 "--message=deescription"], change_info.patch).AndReturn(("1", "2"))
207 gcl.os.remove('descfile') 207 gcl.os.remove('descfile')
208 gcl.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=0.5) 208 gcl.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=0.5)
209 gcl.os.chdir('somewhere') 209 gcl.os.chdir('somewhere')
210 self.mox.ReplayAll() 210 self.mox.ReplayAll()
211
211 gcl.UploadCL(change_info, args) 212 gcl.UploadCL(change_info, args)
212 213
213 def testNoTry(self): 214 def testNoTry(self):
214 change_info = gcl.ChangeInfo('naame', 0, 0, 'deescription', 215 change_info = gcl.ChangeInfo('naame', 0, 0, 'deescription',
215 ['aa', 'bb']) 216 ['aa', 'bb'])
216 change_info.Save = self.mox.CreateMockAnything() 217 change_info.Save = self.mox.CreateMockAnything()
217 args = ['--no-try'] 218 args = ['--no-try', '--no_watchlists']
218 change_info.Save() 219 change_info.Save()
219 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(True) 220 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(True)
220 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server') 221 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server')
221 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile')) 222 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile'))
222 gcl.os.write(42, change_info.description) 223 gcl.os.write(42, change_info.description)
223 gcl.os.close(42) 224 gcl.os.close(42)
224 gcl.GetCodeReviewSetting('CC_LIST') 225 gcl.GetCodeReviewSetting('CC_LIST')
225 gcl.os.getcwd().AndReturn('somewhere') 226 gcl.os.getcwd().AndReturn('somewhere')
226 gcl.os.chdir(gcl.GetRepositoryRoot().AndReturn(None)) 227 gcl.os.chdir(gcl.GetRepositoryRoot().AndReturn(None))
227 gcl.GenerateDiff(change_info.FileList()) 228 gcl.GenerateDiff(change_info.FileList())
228 gcl.upload.RealMain(['upload.py', '-y', '--server=my_server', 229 gcl.upload.RealMain(['upload.py', '-y', '--server=my_server',
229 "--description_file=descfile", 230 "--description_file=descfile",
230 "--message=deescription"], change_info.patch).AndReturn(("1", "2")) 231 "--message=deescription"], change_info.patch).AndReturn(("1", "2"))
231 gcl.os.remove('descfile') 232 gcl.os.remove('descfile')
232 gcl.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=0.5) 233 gcl.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=0.5)
233 gcl.os.chdir('somewhere') 234 gcl.os.chdir('somewhere')
234 self.mox.ReplayAll() 235 self.mox.ReplayAll()
236
235 gcl.UploadCL(change_info, args) 237 gcl.UploadCL(change_info, args)
236 238
237 def testNormal(self): 239 def testNormal(self):
238 change_info = gcl.ChangeInfo('naame', 0, 0, 'deescription', 240 change_info = gcl.ChangeInfo('naame', 0, 0, 'deescription',
239 ['aa', 'bb']) 241 ['aa', 'bb'])
240 self.mox.StubOutWithMock(change_info, 'Save') 242 self.mox.StubOutWithMock(change_info, 'Save')
241 args = [] 243 args = ['--no_watchlists']
242 change_info.Save() 244 change_info.Save()
243 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(True) 245 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(True)
244 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server') 246 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server')
245 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile')) 247 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile'))
246 gcl.os.write(42, change_info.description) 248 gcl.os.write(42, change_info.description)
247 gcl.os.close(42) 249 gcl.os.close(42)
248 gcl.GetCodeReviewSetting('CC_LIST') 250 gcl.GetCodeReviewSetting('CC_LIST')
249 gcl.os.getcwd().AndReturn('somewhere') 251 gcl.os.getcwd().AndReturn('somewhere')
250 gcl.os.chdir(gcl.GetRepositoryRoot().AndReturn(None)) 252 gcl.os.chdir(gcl.GetRepositoryRoot().AndReturn(None))
251 gcl.GenerateDiff(change_info.FileList()) 253 gcl.GenerateDiff(change_info.FileList())
252 gcl.upload.RealMain(['upload.py', '-y', '--server=my_server', 254 gcl.upload.RealMain(['upload.py', '-y', '--server=my_server',
253 "--description_file=descfile", 255 "--description_file=descfile",
254 "--message=deescription"], change_info.patch).AndReturn(("1", "2")) 256 "--message=deescription"], change_info.patch).AndReturn(("1", "2"))
255 gcl.os.remove('descfile') 257 gcl.os.remove('descfile')
256 gcl.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=0.5) 258 gcl.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=0.5)
257 gcl.GetCodeReviewSetting('TRY_ON_UPLOAD').AndReturn('True') 259 gcl.GetCodeReviewSetting('TRY_ON_UPLOAD').AndReturn('True')
258 gcl.TryChange(change_info, [], swallow_exception=True) 260 gcl.TryChange(change_info, [], swallow_exception=True)
259 gcl.os.chdir('somewhere') 261 gcl.os.chdir('somewhere')
260 self.mox.ReplayAll() 262 self.mox.ReplayAll()
261 263
262 gcl.UploadCL(change_info, args) 264 gcl.UploadCL(change_info, args)
263 self.assertEquals(change_info.issue, 1) 265 self.assertEquals(change_info.issue, 1)
264 self.assertEquals(change_info.patchset, 2) 266 self.assertEquals(change_info.patchset, 2)
265 267
266 268
267 if __name__ == '__main__': 269 if __name__ == '__main__':
268 unittest.main() 270 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698