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

Side by Side Diff: recipe_modules/step/example.py

Issue 2797023002: Always identify test names that lead to failures (Closed)
Patch Set: review Created 3 years, 8 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
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 from recipe_engine import recipe_api, config 5 from recipe_engine import recipe_api, config
6 6
7 DEPS = [ 7 DEPS = [
8 'path', 8 'path',
9 'properties', 9 'properties',
10 'step', 10 'step',
(...skipping 14 matching lines...) Expand all
25 25
26 26
27 def RunSteps( 27 def RunSteps(
28 api, bad_return, raise_infra_failure, access_invalid_data, timeout): 28 api, bad_return, raise_infra_failure, access_invalid_data, timeout):
29 if bad_return: 29 if bad_return:
30 return RETURN_SCHEMA.new(test_me='this should fail') 30 return RETURN_SCHEMA.new(test_me='this should fail')
31 elif timeout: 31 elif timeout:
32 # Timeout causes the recipe engine to raise an exception if your step takes 32 # Timeout causes the recipe engine to raise an exception if your step takes
33 # longer to run than you allow. Units are seconds. 33 # longer to run than you allow. Units are seconds.
34 if timeout == 1: 34 if timeout == 1:
35 raise Exception('fuu')
iannucci 2017/04/04 20:24:51 did you mean to leave this in? should this be adde
Paweł Hajdan Jr. 2017/04/04 20:32:03 Ouch, indeed left by mistake. Also detected by pre
35 api.step('timeout', ['sleep', '20'], timeout=1) 36 api.step('timeout', ['sleep', '20'], timeout=1)
36 elif timeout == 2: 37 elif timeout == 2:
37 try: 38 try:
38 api.step('caught timeout', ['sleep', '20'], timeout=1) 39 api.step('caught timeout', ['sleep', '20'], timeout=1)
39 except api.step.StepTimeout: 40 except api.step.StepTimeout:
40 return RETURN_SCHEMA(test_me=4) 41 return RETURN_SCHEMA(test_me=4)
41 42
42 43
43 # TODO(martinis) change this 44 # TODO(martinis) change this
44 # The api.step object is directly callable. 45 # The api.step object is directly callable.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 api.test('timeout') + 172 api.test('timeout') +
172 api.properties(timeout=1) + 173 api.properties(timeout=1) +
173 api.step_data('timeout', times_out_after=20) 174 api.step_data('timeout', times_out_after=20)
174 ) 175 )
175 176
176 yield ( 177 yield (
177 api.test('catch_timeout') + 178 api.test('catch_timeout') +
178 api.properties(timeout=2) + 179 api.properties(timeout=2) +
179 api.step_data('caught timeout', times_out_after=20) 180 api.step_data('caught timeout', times_out_after=20)
180 ) 181 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698