| OLD | NEW |
| (Empty) |
| 1 # Copyright 2015 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 | |
| 6 DEPS = [ | |
| 7 'step', | |
| 8 ] | |
| 9 | |
| 10 | |
| 11 def RunSteps(api): | |
| 12 # Nest all steps below this. | |
| 13 with api.step.nest('complicated thing'): | |
| 14 with api.step.nest('first part'): | |
| 15 api.step('wait a bit', ['sleep', '1']) | |
| 16 | |
| 17 # Prefix the name without indenting. | |
| 18 with api.step.context({'name': 'attempt number'}): | |
| 19 step_result = api.step('one', ['echo', 'herpy']) | |
| 20 assert step_result.step['name'] == 'complicated thing.attempt number.one' | |
| 21 api.step('two', ['echo', 'derpy']) | |
| 22 | |
| 23 # Outer nested step's status should not inherit from inner. | |
| 24 with api.step.nest('inherit status') as nest_step: | |
| 25 with api.step.nest('inner step') as other_nest_step: | |
| 26 other_nest_step.presentation.status = api.step.EXCEPTION | |
| 27 assert nest_step.presentation.status == api.step.SUCCESS | |
| 28 | |
| 29 # Change outer status after nesting is complete. | |
| 30 with api.step.nest('versatile status') as nest_step: | |
| 31 with api.step.nest('inner step'): | |
| 32 with api.step.nest('even deeper'): | |
| 33 pass | |
| 34 nest_step.presentation.status = api.step.FAILURE | |
| 35 assert nest_step.presentation.status == api.step.FAILURE | |
| 36 | |
| 37 api.step('simple thing', ['sleep', '1']) | |
| 38 | |
| 39 | |
| 40 def GenTests(api): | |
| 41 yield api.test('basic') | |
| OLD | NEW |