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

Side by Side Diff: tools/push-to-trunk/test_scripts.py

Issue 183923013: Add coverage analysis to push and merge script tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | « tools/push-to-trunk/script_test.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/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 class SimpleMock(object): 232 class SimpleMock(object):
233 def __init__(self, name): 233 def __init__(self, name):
234 self._name = name 234 self._name = name
235 self._recipe = [] 235 self._recipe = []
236 self._index = -1 236 self._index = -1
237 237
238 def Expect(self, recipe): 238 def Expect(self, recipe):
239 self._recipe = recipe 239 self._recipe = recipe
240 240
241 def Call(self, *args): 241 def Call(self, *args): # pragma: no cover
242 self._index += 1 242 self._index += 1
243 try: 243 try:
244 expected_call = self._recipe[self._index] 244 expected_call = self._recipe[self._index]
245 except IndexError: 245 except IndexError:
246 raise NoRetryException("Calling %s %s" % (self._name, " ".join(args))) 246 raise NoRetryException("Calling %s %s" % (self._name, " ".join(args)))
247 247
248 # Pack expectations without arguments into a list. 248 # Pack expectations without arguments into a list.
249 if not isinstance(expected_call, list): 249 if not isinstance(expected_call, list):
250 expected_call = [expected_call] 250 expected_call = [expected_call]
251 251
(...skipping 17 matching lines...) Expand all
269 except: 269 except:
270 tb = traceback.format_exc() 270 tb = traceback.format_exc()
271 raise NoRetryException("Caught exception from callback: %s" % tb) 271 raise NoRetryException("Caught exception from callback: %s" % tb)
272 return_value = expected_call[len(args)] 272 return_value = expected_call[len(args)]
273 273
274 # If the return value is an exception, raise it instead of returning. 274 # If the return value is an exception, raise it instead of returning.
275 if isinstance(return_value, Exception): 275 if isinstance(return_value, Exception):
276 raise return_value 276 raise return_value
277 return return_value 277 return return_value
278 278
279 def AssertFinished(self): 279 def AssertFinished(self): # pragma: no cover
280 if self._index < len(self._recipe) -1: 280 if self._index < len(self._recipe) -1:
281 raise NoRetryException("Called %s too seldom: %d vs. %d" 281 raise NoRetryException("Called %s too seldom: %d vs. %d"
282 % (self._name, self._index, len(self._recipe))) 282 % (self._name, self._index, len(self._recipe)))
283 283
284 284
285 class ScriptTest(unittest.TestCase): 285 class ScriptTest(unittest.TestCase):
286 def MakeEmptyTempFile(self): 286 def MakeEmptyTempFile(self):
287 handle, name = tempfile.mkstemp() 287 handle, name = tempfile.mkstemp()
288 os.close(handle) 288 os.close(handle)
289 self._tmp_files.append(name) 289 self._tmp_files.append(name)
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 1011
1012 Review URL: https://codereview.chromium.org/83173002 1012 Review URL: https://codereview.chromium.org/83173002
1013 1013
1014 ------------------------------------------------------------------------""") 1014 ------------------------------------------------------------------------""")
1015 self.assertEquals( 1015 self.assertEquals(
1016 """Prepare push to trunk. Now working on version 3.23.11. 1016 """Prepare push to trunk. Now working on version 3.23.11.
1017 1017
1018 R=danno@chromium.org 1018 R=danno@chromium.org
1019 1019
1020 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body) 1020 Committed: https://code.google.com/p/v8/source/detail?r=17997""", body)
OLDNEW
« no previous file with comments | « tools/push-to-trunk/script_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698