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

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

Issue 2590693002: Only add unstaged baseline changes to the git index when rebaselining. (Closed)
Patch Set: rebaseline-cl: Abort if there are unstaged baseline changes. Created 3 years, 12 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 | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.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 # 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 optparse 5 import optparse
6 import unittest 6 import unittest
7 7
8 from webkitpy.common.net.buildbot import Build 8 from webkitpy.common.net.buildbot import Build
9 from webkitpy.common.net.layout_test_results import LayoutTestResults 9 from webkitpy.common.net.layout_test_results import LayoutTestResults
10 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2 10 from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 # Note that we have only one run_in_parallel() call 477 # Note that we have only one run_in_parallel() call
478 self.assertEqual( 478 self.assertEqual(
479 self.tool.executive.calls, 479 self.tool.executive.calls,
480 [ 480 [
481 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png', 481 [['python', 'echo', 'copy-existing-baselines-internal', '--suffi xes', 'txt,png',
482 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']], 482 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose']],
483 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png', 483 [['python', 'echo', 'rebaseline-test-internal', '--suffixes', 't xt,png',
484 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose', '--results-directory', '/tmp']] 484 '--builder', 'MOCK Win7', '--test', 'userscripts/first-test.ht ml', '--verbose', '--results-directory', '/tmp']]
485 ]) 485 ])
486 486
487 def test_unstaged_baselines(self):
488 scm = self.tool.scm()
489 scm.unstaged_changes = lambda: {
490 'third_party/WebKit/LayoutTests/x/foo-expected.txt': 'M',
491 'third_party/WebKit/LayoutTests/x/foo-expected.something': '?',
492 'third_party/WebKit/LayoutTests/x/foo-expected.png': '?',
493 'third_party/WebKit/LayoutTests/x/foo.html': 'M',
494 'docs/something.md': '?',
495 }
496 self.assertEqual(
497 self.command.unstaged_baselines(),
498 [
499 '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.pn g',
500 '/mock-checkout/third_party/WebKit/LayoutTests/x/foo-expected.tx t',
501 ])
502
487 503
488 class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase): 504 class TestRebaselineJsonUpdatesExpectationsFiles(BaseTestCase):
489 command_constructor = RebaselineJson 505 command_constructor = RebaselineJson
490 506
491 def setUp(self): 507 def setUp(self):
492 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp() 508 super(TestRebaselineJsonUpdatesExpectationsFiles, self).setUp()
493 self.tool.executive = MockExecutive2() 509 self.tool.executive = MockExecutive2()
494 510
495 def mock_run_command(*args, **kwargs): # pylint: disable=unused-argumen t 511 def mock_run_command(*args, **kwargs): # pylint: disable=unused-argumen t
496 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "MOCK Mac10.11"}]}\n' 512 return '{"add": [], "remove-lines": [{"test": "userscripts/first-tes t.html", "builder": "MOCK Mac10.11"}]}\n'
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 for cmd_line, cwd in commands: 942 for cmd_line, cwd in commands:
927 out = self.run_command(cmd_line, cwd=cwd) 943 out = self.run_command(cmd_line, cwd=cwd)
928 if 'rebaseline-test-internal' in cmd_line: 944 if 'rebaseline-test-internal' in cmd_line:
929 out = '{"remove-lines": [{"test": "%s", "builder": "%s"}]}\n' % (cmd_line[8], cmd_line[6]) 945 out = '{"remove-lines": [{"test": "%s", "builder": "%s"}]}\n' % (cmd_line[8], cmd_line[6])
930 command_outputs.append([0, out, '']) 946 command_outputs.append([0, out, ''])
931 947
932 new_calls = self.calls[num_previous_calls:] 948 new_calls = self.calls[num_previous_calls:]
933 self.calls = self.calls[:num_previous_calls] 949 self.calls = self.calls[:num_previous_calls]
934 self.calls.append(new_calls) 950 self.calls.append(new_calls)
935 return command_outputs 951 return command_outputs
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_cl_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698