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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py

Issue 2692233002: [WPT Export] Fix cwd on run_command calls in ChromiumCommit (Closed)
Patch Set: Strictly assert that SHA-1 hash was passed to ChromiumCommit Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py
index e859d256e5e8c8f53afe23c8a76ec12a147ecbfc..10746018de3f0e1b84820c1b8dc3ebafb713fc55 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/common_unittest.py
@@ -18,6 +18,13 @@ def mock_command_exec(vals):
return MockExecutive(run_command_fn=run_fn)
+def mock_command_exec_strict(vals):
+ def run_fn(args):
+ sub_command = args[1]
+ return vals[sub_command]
+ return MockExecutive(run_command_fn=run_fn)
+
+
jeffcarp 2017/02/14 02:20:48 The only changes in the tests are the 1. addition
qyearsley 2017/02/14 05:17:34 Optional possible change to this function; since y
class MockLocalWPT(object):
def test_patch(self, patch, chromium_commit): # pylint: disable=unused-argument
@@ -30,9 +37,9 @@ class CommonTest(unittest.TestCase):
host = MockHost()
host.executive = mock_command_exec({
'show': 'fake message',
- 'rev-list': 'badbeef8',
- 'rev-parse': 'badbeef8',
- 'crrev-parse': 'badbeef8',
+ 'rev-list': 'add087a97844f4b9e307d9a216940582d96db306',
+ 'rev-parse': 'add087a97844f4b9e307d9a216940582d96db306',
+ 'crrev-parse': 'add087a97844f4b9e307d9a216940582d96db306',
'diff': 'fake diff',
'diff-tree': 'some\nfiles',
'format-patch': 'hey I\'m a patch',
@@ -44,60 +51,62 @@ class CommonTest(unittest.TestCase):
self.assertIsInstance(commits[0], ChromiumCommit)
self.assertEqual(host.executive.calls, [
['git', 'rev-parse', '--show-toplevel'],
- ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--', 'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
- ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
+ ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
+ 'add087a97844f4b9e307d9a216940582d96db306/third_party/WebKit/LayoutTests/external/wpt/'],
+ ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'add087a97844f4b9e307d9a216940582d96db306', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
- ['git', 'format-patch', '-1', '--stdout', 'badbeef8', '--', 'some', 'files'],
- ['git', 'show', '--format=%B', '--no-patch', 'badbeef8'],
- ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']
+ ['git', 'format-patch', '-1', '--stdout', 'add087a97844f4b9e307d9a216940582d96db306', '--', 'some', 'files'],
+ ['git', 'show', '--format=%B', '--no-patch', 'add087a97844f4b9e307d9a216940582d96db306'],
+ ['git', 'show', '--format=%B', '--no-patch', 'add087a97844f4b9e307d9a216940582d96db306']
])
def test_ignores_commits_with_noexport_true(self):
host = MockHost()
host.executive = mock_command_exec({
'show': 'Commit message\nNOEXPORT=true',
- 'rev-list': 'badbeef8',
- 'rev-parse': 'badbeef8',
+ 'rev-list': 'add087a97844f4b9e307d9a216940582d96db306',
+ 'rev-parse': 'add087a97844f4b9e307d9a216940582d96db306',
'footers': 'cr-rev-position',
})
- commits = exportable_commits_since('beefcafe', host, MockLocalWPT())
+ commits = exportable_commits_since('add087a97844f4b9e307d9a216940582d96db306', host, MockLocalWPT())
self.assertEqual(commits, [])
self.assertEqual(host.executive.calls, [
['git', 'rev-parse', '--show-toplevel'],
- ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
- 'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
- ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
+ ['git', 'rev-list', 'add087a97844f4b9e307d9a216940582d96db306..HEAD', '--reverse', '--',
+ 'add087a97844f4b9e307d9a216940582d96db306/third_party/WebKit/LayoutTests/external/wpt/'],
+ ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'add087a97844f4b9e307d9a216940582d96db306', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
- ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']
+ ['git', 'show', '--format=%B', '--no-patch', 'add087a97844f4b9e307d9a216940582d96db306']
])
def test_ignores_reverted_commits_with_noexport_true(self):
host = MockHost()
- host.executive = mock_command_exec({
+ host.executive = mock_command_exec_strict({
'show': 'Commit message\n> NOEXPORT=true',
- 'rev-list': 'badbeef8',
- 'rev-parse': 'badbeef8',
+ 'rev-list': 'add087a97844f4b9e307d9a216940582d96db306',
+ 'rev-parse': 'add087a97844f4b9e307d9a216940582d96db306',
'footers': 'cr-rev-position',
+ 'diff-tree': '',
})
- commits = exportable_commits_since('beefcafe', host, MockLocalWPT())
+ commits = exportable_commits_since('add087a97844f4b9e307d9a216940582d96db306', host, MockLocalWPT())
self.assertEqual(len(commits), 0)
self.assertEqual(host.executive.calls, [
['git', 'rev-parse', '--show-toplevel'],
- ['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
- 'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
- ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
+ ['git', 'rev-list', 'add087a97844f4b9e307d9a216940582d96db306..HEAD', '--reverse', '--',
+ 'add087a97844f4b9e307d9a216940582d96db306/third_party/WebKit/LayoutTests/external/wpt/'],
+ ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'add087a97844f4b9e307d9a216940582d96db306', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
- ['git', 'show', '--format=%B', '--no-patch', 'badbeef8']
+ ['git', 'show', '--format=%B', '--no-patch', 'add087a97844f4b9e307d9a216940582d96db306']
])
def test_ignores_commits_that_start_with_import(self):
host = MockHost()
host.executive = mock_command_exec({
'show': 'Import rutabaga@deadbeef',
- 'rev-list': 'badbeef8',
- 'rev-parse': 'badbeef8',
+ 'rev-list': 'add087a97844f4b9e307d9a216940582d96db306',
+ 'rev-parse': 'add087a97844f4b9e307d9a216940582d96db306',
'footers': 'cr-rev-position',
})
@@ -106,9 +115,9 @@ class CommonTest(unittest.TestCase):
self.assertEqual(host.executive.calls, [
['git', 'rev-parse', '--show-toplevel'],
['git', 'rev-list', 'beefcafe..HEAD', '--reverse', '--',
- 'badbeef8/third_party/WebKit/LayoutTests/external/wpt/'],
- ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'badbeef8', '--',
+ 'add087a97844f4b9e307d9a216940582d96db306/third_party/WebKit/LayoutTests/external/wpt/'],
+ ['git', 'diff-tree', '--name-only', '--no-commit-id', '-r', 'add087a97844f4b9e307d9a216940582d96db306', '--',
'/mock-checkout/third_party/WebKit/LayoutTests/external/wpt'],
- ['git', 'show', '--format=%B', '--no-patch', 'badbeef8'],
- ['git', 'show', '--format=%B', '--no-patch', 'badbeef8'],
+ ['git', 'show', '--format=%B', '--no-patch', 'add087a97844f4b9e307d9a216940582d96db306'],
+ ['git', 'show', '--format=%B', '--no-patch', 'add087a97844f4b9e307d9a216940582d96db306'],
])

Powered by Google App Engine
This is Rietveld 408576698