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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer_unittest.py

Issue 2684663003: WPT importer: List directory owners in CL description. (Closed)
Patch Set: Update change to not change TBR line. 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.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 collections 5 import collections
6 6
7 from webkitpy.common.checkout.git_mock import MockGit 7 from webkitpy.common.checkout.git_mock import MockGit
8 from webkitpy.common.host_mock import MockHost 8 from webkitpy.common.host_mock import MockHost
9 from webkitpy.common.system.executive_mock import MockExecutive 9 from webkitpy.common.system.executive_mock import MockExecutive
10 from webkitpy.common.system.log_testing import LoggingTestCase 10 from webkitpy.common.system.log_testing import LoggingTestCase
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 self.assertEqual( 69 self.assertEqual(
70 importer._commit_message('aaaa', '1111'), 70 importer._commit_message('aaaa', '1111'),
71 'Import 1111\n\n' 71 'Import 1111\n\n'
72 'Using wpt-import in Chromium aaaa.\n\n' 72 'Using wpt-import in Chromium aaaa.\n\n'
73 'NOEXPORT=true') 73 'NOEXPORT=true')
74 74
75 def test_cl_description_with_empty_environ(self): 75 def test_cl_description_with_empty_environ(self):
76 host = MockHost() 76 host = MockHost()
77 host.executive = MockExecutive(output='Last commit message\n\n') 77 host.executive = MockExecutive(output='Last commit message\n\n')
78 importer = TestImporter(host) 78 importer = TestImporter(host)
79 description = importer._cl_description() 79 description = importer._cl_description(directory_owners={})
80 self.assertEqual( 80 self.assertEqual(
81 description, 81 description,
82 ('Last commit message\n\n' 82 ('Last commit message\n\n'
83 'TBR=qyearsley@chromium.org\n' 83 'TBR=qyearsley@chromium.org\n'
84 'NOEXPORT=true')) 84 'NOEXPORT=true'))
85 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']]) 85 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']])
86 86
87 def test_cl_description_with_environ_variables(self): 87 def test_cl_description_with_environ_variables(self):
88 host = MockHost() 88 host = MockHost()
89 host.executive = MockExecutive(output='Last commit message\n') 89 host.executive = MockExecutive(output='Last commit message\n')
90 importer = TestImporter(host) 90 importer = TestImporter(host)
91 importer.host.environ['BUILDBOT_MASTERNAME'] = 'my.master' 91 importer.host.environ['BUILDBOT_MASTERNAME'] = 'my.master'
92 importer.host.environ['BUILDBOT_BUILDERNAME'] = 'b' 92 importer.host.environ['BUILDBOT_BUILDERNAME'] = 'b'
93 importer.host.environ['BUILDBOT_BUILDNUMBER'] = '123' 93 importer.host.environ['BUILDBOT_BUILDNUMBER'] = '123'
94 description = importer._cl_description() 94 description = importer._cl_description(directory_owners={})
95 self.assertEqual( 95 self.assertEqual(
96 description, 96 description,
97 ('Last commit message\n' 97 ('Last commit message\n'
98 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12 3\n\n' 98 'Build: https://build.chromium.org/p/my.master/builders/b/builds/12 3\n\n'
99 'TBR=qyearsley@chromium.org\n' 99 'TBR=qyearsley@chromium.org\n'
100 'NOEXPORT=true')) 100 'NOEXPORT=true'))
101 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']]) 101 self.assertEqual(host.executive.calls, [['git', 'log', '-1', '--format=% B']])
102 102
103 def test_cl_description_moves_noexport_tag(self): 103 def test_cl_description_moves_noexport_tag(self):
104 host = MockHost() 104 host = MockHost()
105 host.executive = MockExecutive(output='Summary\n\nNOEXPORT=true\n\n') 105 host.executive = MockExecutive(output='Summary\n\nNOEXPORT=true\n\n')
106 importer = TestImporter(host) 106 importer = TestImporter(host)
107 description = importer._cl_description() 107 description = importer._cl_description(directory_owners={})
108 self.assertEqual( 108 self.assertEqual(
109 description, 109 description,
110 ('Summary\n\n' 110 ('Summary\n\n'
111 'TBR=qyearsley@chromium.org\n' 111 'TBR=qyearsley@chromium.org\n'
112 'NOEXPORT=true')) 112 'NOEXPORT=true'))
113 113
114 def test_cl_description_with_directory_owners(self):
115 host = MockHost()
116 host.executive = MockExecutive(output='Last commit message\n\n')
117 importer = TestImporter(host)
118 description = importer._cl_description(directory_owners={
119 'someone@chromium.org': ['external/wpt/foo', 'external/wpt/bar'],
120 'someone-else@chromium.org': ['external/wpt/baz'],
121 })
122 self.assertEqual(
123 description,
124 ('Last commit message\n\n'
125 'Directory owners for changes in this CL:\n'
126 'someone-else@chromium.org:\n'
127 ' external/wpt/baz\n'
128 'someone@chromium.org:\n'
129 ' external/wpt/foo\n'
130 ' external/wpt/bar\n\n'
131 'TBR=qyearsley@chromium.org\n'
132 'NOEXPORT=true'))
133
114 def test_generate_manifest_command_not_found(self): 134 def test_generate_manifest_command_not_found(self):
115 # If we're updating csswg-test, then the manifest file won't be found. 135 # If we're updating csswg-test, then the manifest file won't be found.
116 host = MockHost() 136 host = MockHost()
117 host.filesystem.files = {} 137 host.filesystem.files = {}
118 importer = TestImporter(host) 138 importer = TestImporter(host)
119 importer._generate_manifest( 139 importer._generate_manifest(
120 '/mock-checkout/third_party/WebKit/LayoutTests/external/csswg-test') 140 '/mock-checkout/third_party/WebKit/LayoutTests/external/csswg-test')
121 self.assertEqual(host.executive.calls, []) 141 self.assertEqual(host.executive.calls, [])
122 142
123 def test_generate_manifest_successful_run(self): 143 def test_generate_manifest_successful_run(self):
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 self.assertEqual(importer.get_directory_owners(), {'someone@chromium.org ': 'external/wpt/foo'}) 176 self.assertEqual(importer.get_directory_owners(), {'someone@chromium.org ': 'external/wpt/foo'})
157 177
158 def test_get_directory_owners_no_changed_files(self): 178 def test_get_directory_owners_no_changed_files(self):
159 host = MockHost() 179 host = MockHost()
160 host.filesystem.write_text_file( 180 host.filesystem.write_text_file(
161 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations ', 181 '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations ',
162 '## Owners: someone@chromium.org\n' 182 '## Owners: someone@chromium.org\n'
163 '# external/wpt/foo [ Pass ]\n') 183 '# external/wpt/foo [ Pass ]\n')
164 importer = TestImporter(host) 184 importer = TestImporter(host)
165 self.assertEqual(importer.get_directory_owners(), {}) 185 self.assertEqual(importer.get_directory_owners(), {})
OLDNEW
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698