| Index: recipes/example/defer.py
|
| diff --git a/recipes/example/defer.py b/recipes/example/defer.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f1051df5dd6eb0729ae8484e92fa5b2132ed8572
|
| --- /dev/null
|
| +++ b/recipes/example/defer.py
|
| @@ -0,0 +1,26 @@
|
| +# Copyright 2014 The LUCI Authors. All rights reserved.
|
| +# Use of this source code is governed under the Apache License, Version 2.0
|
| +# that can be found in the LICENSE file.
|
| +
|
| +DEPS = [
|
| + 'step',
|
| +]
|
| +
|
| +def RunSteps(api):
|
| + ran_both = False
|
| + try:
|
| + with api.step.defer_results():
|
| + api.step("testa", ["echo", "testa"])
|
| + api.step("testb", ["echo", "testb"])
|
| + ran_both = True
|
| + finally:
|
| + assert ran_both
|
| +
|
| +
|
| +def GenTests(api):
|
| + yield api.test('basic')
|
| +
|
| + yield (
|
| + api.test('one_fail') +
|
| + api.step_data('testa', retcode=1)
|
| + )
|
|
|