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

Side by Side Diff: cros_mark_as_stable_unittest.py

Issue 3956007: Always pass board to cros_mark_as_stable. (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « cros_mark_as_stable.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 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Unit tests for cros_mark_as_stable.py.""" 7 """Unit tests for cros_mark_as_stable.py."""
8 8
9 9
10 import mox 10 import mox
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path) 162 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path)
163 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, 163 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path,
164 inplace=1).AndReturn(mock_file) 164 inplace=1).AndReturn(mock_file)
165 m_file.write('EAPI=2') 165 m_file.write('EAPI=2')
166 m_file.write('CROS_WORKON_COMMIT="my_id"\n') 166 m_file.write('CROS_WORKON_COMMIT="my_id"\n')
167 m_file.write('KEYWORDS="x86 arm"') 167 m_file.write('KEYWORDS="x86 arm"')
168 m_file.write('src_unpack(){}') 168 m_file.write('src_unpack(){}')
169 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, 169 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path,
170 self.revved_ebuild_path] 170 self.revved_ebuild_path]
171 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, 171 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True,
172 print_cmd=False).AndReturn(1) 172 print_cmd=False, redirect_stderr=True,
173 redirect_stdout=True).AndReturn(1)
173 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path) 174 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path)
174 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path) 175 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path)
175 176
176 self.mox.ReplayAll() 177 self.mox.ReplayAll()
177 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 178 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
178 marker.RevEBuild('my_id', redirect_file=m_file) 179 marker.RevEBuild('my_id', redirect_file=m_file)
179 self.mox.VerifyAll() 180 self.mox.VerifyAll()
180 181
181 def testRevUnchangedEBuild(self): 182 def testRevUnchangedEBuild(self):
182 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') 183 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input')
(...skipping 11 matching lines...) Expand all
194 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path) 195 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path)
195 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, 196 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path,
196 inplace=1).AndReturn(mock_file) 197 inplace=1).AndReturn(mock_file)
197 m_file.write('EAPI=2') 198 m_file.write('EAPI=2')
198 m_file.write('CROS_WORKON_COMMIT="my_id"\n') 199 m_file.write('CROS_WORKON_COMMIT="my_id"\n')
199 m_file.write('KEYWORDS="x86 arm"') 200 m_file.write('KEYWORDS="x86 arm"')
200 m_file.write('src_unpack(){}') 201 m_file.write('src_unpack(){}')
201 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, 202 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path,
202 self.revved_ebuild_path] 203 self.revved_ebuild_path]
203 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, 204 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True,
204 print_cmd=False).AndReturn(0) 205 print_cmd=False, redirect_stderr=True,
206 redirect_stdout=True).AndReturn(0)
205 cros_mark_as_stable.os.unlink(self.revved_ebuild_path) 207 cros_mark_as_stable.os.unlink(self.revved_ebuild_path)
206 208
207 self.mox.ReplayAll() 209 self.mox.ReplayAll()
208 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 210 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
209 marker.RevEBuild('my_id', redirect_file=m_file) 211 marker.RevEBuild('my_id', redirect_file=m_file)
210 self.mox.VerifyAll() 212 self.mox.VerifyAll()
211 213
212 def testRevMissingEBuild(self): 214 def testRevMissingEBuild(self):
213 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') 215 self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input')
214 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists') 216 self.mox.StubOutWithMock(cros_mark_as_stable.os.path, 'exists')
(...skipping 12 matching lines...) Expand all
227 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path) 229 cros_mark_as_stable.shutil.copyfile(ebuild_9999, self.revved_ebuild_path)
228 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path, 230 cros_mark_as_stable.fileinput.input(self.revved_ebuild_path,
229 inplace=1).AndReturn(mock_file) 231 inplace=1).AndReturn(mock_file)
230 m_file.write('EAPI=2') 232 m_file.write('EAPI=2')
231 m_file.write('CROS_WORKON_COMMIT="my_id"\n') 233 m_file.write('CROS_WORKON_COMMIT="my_id"\n')
232 m_file.write('KEYWORDS="x86 arm"') 234 m_file.write('KEYWORDS="x86 arm"')
233 m_file.write('src_unpack(){}') 235 m_file.write('src_unpack(){}')
234 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path, 236 diff_cmd = ['diff', '-Bu', self.m_ebuild.ebuild_path,
235 self.revved_ebuild_path] 237 self.revved_ebuild_path]
236 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True, 238 cros_mark_as_stable.RunCommand(diff_cmd, exit_code=True,
237 print_cmd=False).AndReturn(1) 239 print_cmd=False, redirect_stderr=True,
240 redirect_stdout=True).AndReturn(1)
238 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path) 241 cros_mark_as_stable._SimpleRunCommand('git add ' + self.revved_ebuild_path)
239 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path) 242 cros_mark_as_stable._SimpleRunCommand('git rm ' + self.m_ebuild.ebuild_path)
240 243
241 self.mox.ReplayAll() 244 self.mox.ReplayAll()
242 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild) 245 marker = cros_mark_as_stable.EBuildStableMarker(self.m_ebuild)
243 marker.RevEBuild('my_id', redirect_file=m_file) 246 marker.RevEBuild('my_id', redirect_file=m_file)
244 self.mox.VerifyAll() 247 self.mox.VerifyAll()
245 248
246 249
247 def testCommitChange(self): 250 def testCommitChange(self):
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 cros_mark_as_stable._FindStableEBuilds([]).AndReturn(package) 300 cros_mark_as_stable._FindStableEBuilds([]).AndReturn(package)
298 self.mox.ReplayAll() 301 self.mox.ReplayAll()
299 cros_mark_as_stable._BuildEBuildDictionary(overlays, False, []) 302 cros_mark_as_stable._BuildEBuildDictionary(overlays, False, [])
300 self.assertEquals(len(overlays), 1) 303 self.assertEquals(len(overlays), 1)
301 self.assertEquals(overlays["/overlay"], []) 304 self.assertEquals(overlays["/overlay"], [])
302 self.mox.VerifyAll() 305 self.mox.VerifyAll()
303 306
304 307
305 if __name__ == '__main__': 308 if __name__ == '__main__':
306 unittest.main() 309 unittest.main()
OLDNEW
« no previous file with comments | « cros_mark_as_stable.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698