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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py

Issue 2890373003: Refactoring: Extract some logic from RebaselineCL.execute. (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import json 5 import json
6 import optparse 6 import optparse
7 7
8 from webkitpy.common.net.buildbot import Build 8 from webkitpy.common.net.buildbot import Build
9 from webkitpy.common.net.git_cl import GitCL 9 from webkitpy.common.net.git_cl import GitCL
10 from webkitpy.common.checkout.git_mock import MockGit 10 from webkitpy.common.checkout.git_mock import MockGit
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 git_cl.get_issue_number = lambda: '11112222' 235 git_cl.get_issue_number = lambda: '11112222'
236 git_cl.latest_try_jobs = lambda _: builds 236 git_cl.latest_try_jobs = lambda _: builds
237 self.command.git_cl = lambda: git_cl 237 self.command.git_cl = lambda: git_cl
238 238
239 return_code = self.command.execute(self.command_options(trigger_jobs=Tru e), [], self.tool) 239 return_code = self.command.execute(self.command_options(trigger_jobs=Tru e), [], self.tool)
240 240
241 self.assertEqual(return_code, 1) 241 self.assertEqual(return_code, 1)
242 self.assertLog([ 242 self.assertLog([
243 'INFO: Triggering try jobs for:\n', 243 'INFO: Triggering try jobs for:\n',
244 'INFO: MOCK Try Linux\n', 244 'INFO: MOCK Try Linux\n',
245 'INFO: Please re-run webkit-patch rebaseline-cl once all pending try jobs have finished.\n', 245 'INFO: Once all pending try jobs have finished, please re-run\n'
246 'webkit-patch rebaseline-cl to fetch new baselines.\n',
246 ]) 247 ])
247 self.assertEqual( 248 self.assertEqual(
248 self.tool.executive.calls, 249 self.tool.executive.calls,
249 [ 250 [
250 [ 251 [
251 'python', 252 'python',
252 '/mock-checkout/third_party/WebKit/Tools/Scripts/webkitpy/th irdparty/wpt/wpt/manifest', 253 '/mock-checkout/third_party/WebKit/Tools/Scripts/webkitpy/th irdparty/wpt/wpt/manifest',
253 '--work', 254 '--work',
254 '--tests-root', 255 '--tests-root',
255 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt' 256 '/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 def test_trigger_builds(self): 298 def test_trigger_builds(self):
298 # The trigger_builds method just uses git cl to trigger jobs for the giv en builders. 299 # The trigger_builds method just uses git cl to trigger jobs for the giv en builders.
299 self.command.trigger_builds(['MOCK Try Linux', 'MOCK Try Win']) 300 self.command.trigger_builds(['MOCK Try Linux', 'MOCK Try Win'])
300 self.assertEqual( 301 self.assertEqual(
301 self.tool.executive.calls, 302 self.tool.executive.calls,
302 [['git', 'cl', 'try', '-m', 'tryserver.blink', '-b', 'MOCK Try Linux ', '-b', 'MOCK Try Win']]) 303 [['git', 'cl', 'try', '-m', 'tryserver.blink', '-b', 'MOCK Try Linux ', '-b', 'MOCK Try Win']])
303 self.assertLog([ 304 self.assertLog([
304 'INFO: Triggering try jobs for:\n', 305 'INFO: Triggering try jobs for:\n',
305 'INFO: MOCK Try Linux\n', 306 'INFO: MOCK Try Linux\n',
306 'INFO: MOCK Try Win\n', 307 'INFO: MOCK Try Win\n',
308 'INFO: Once all pending try jobs have finished, please re-run\n'
309 'webkit-patch rebaseline-cl to fetch new baselines.\n',
307 ]) 310 ])
308 311
309 def test_builders_with_pending_builds(self): 312 def test_builders_with_pending_builds(self):
310 # A build number of None implies that a job has been started but not fin ished yet. 313 # A build number of None implies that a job has been started but not fin ished yet.
311 self.assertEqual( 314 self.assertEqual(
312 self.command.builders_with_pending_builds([Build('MOCK Try Linux', N one), Build('MOCK Try Win', 123)]), 315 self.command.builders_with_pending_builds([Build('MOCK Try Linux', N one), Build('MOCK Try Win', 123)]),
313 {'MOCK Try Linux'}) 316 {'MOCK Try Linux'})
314 317
315 def test_builders_with_no_results(self): 318 def test_builders_with_no_results(self):
316 # In this example, Linux has a pending build, and Mac has no build. 319 # In this example, Linux has a pending build, and Mac has no build.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 (Build(builder_name='MOCK Foo12', build_number=100), 'foo-foo12' ), 407 (Build(builder_name='MOCK Foo12', build_number=100), 'foo-foo12' ),
405 (Build(builder_name='MOCK Bar4', build_number=200), 'bar-bar4'), 408 (Build(builder_name='MOCK Bar4', build_number=200), 'bar-bar4'),
406 (Build(builder_name='MOCK Foo12', build_number=100), 'foo-foo45' ), 409 (Build(builder_name='MOCK Foo12', build_number=100), 'foo-foo45' ),
407 (Build(builder_name='MOCK Bar4', build_number=200), 'bar-bar3'), 410 (Build(builder_name='MOCK Bar4', build_number=200), 'bar-bar3'),
408 ]) 411 ])
409 self.assertLog([ 412 self.assertLog([
410 'INFO: For fast/dom/prototype-taco.html:\n', 413 'INFO: For fast/dom/prototype-taco.html:\n',
411 'INFO: Using Build(builder_name=\'MOCK Foo12\', build_number=100) to supply results for foo-foo45.\n', 414 'INFO: Using Build(builder_name=\'MOCK Foo12\', build_number=100) to supply results for foo-foo45.\n',
412 'INFO: Using Build(builder_name=\'MOCK Bar4\', build_number=200) to supply results for bar-bar3.\n', 415 'INFO: Using Build(builder_name=\'MOCK Bar4\', build_number=200) to supply results for bar-bar3.\n',
413 ]) 416 ])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698