| OLD | NEW |
| (Empty) |
| 1 # Copyright 2017 The LUCI Authors. All rights reserved. | |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 # that can be found in the LICENSE file. | |
| 4 | |
| 5 from recipe_engine import recipe_api | |
| 6 | |
| 7 | |
| 8 DEPS = [ | |
| 9 'properties', | |
| 10 'step', | |
| 11 ] | |
| 12 | |
| 13 | |
| 14 PROPERTIES = { | |
| 15 'timeout': recipe_api.Property(default=0, kind=int), | |
| 16 } | |
| 17 | |
| 18 | |
| 19 def RunSteps(api, timeout): | |
| 20 # Timeout causes the recipe engine to raise an exception if your step takes | |
| 21 # longer to run than you allow. Units are seconds. | |
| 22 try: | |
| 23 api.step('timeout', ['sleep', '20'], timeout=1) | |
| 24 except api.step.StepTimeout: | |
| 25 api.step('caught timeout', []) | |
| 26 raise | |
| 27 | |
| 28 | |
| 29 def GenTests(api): | |
| 30 yield ( | |
| 31 api.test('timeout') + | |
| 32 api.properties(timeout=1) + | |
| 33 api.step_data('timeout', times_out_after=20) | |
| 34 ) | |
| OLD | NEW |