mirrored from https://chromium.googlesource.com/infra/luci/recipes-py
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathinfra_step.py
38 lines (32 loc) · 980 Bytes
/
infra_step.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright 2017 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 = [
"context",
"path",
"step",
]
def RunSteps(api):
was_infra_failure = None
try:
api.step('boom', ['echo', 'hello'])
except api.step.InfraFailure: # pragma: no cover
assert False, 'impossible'
except api.step.StepFailure:
was_infra_failure = False
assert was_infra_failure is False, 'got: %r' % was_infra_failure
with api.context(infra_steps=True):
was_infra_failure = None
try:
api.step('boom 2', ['echo', 'hello', 'subdir'])
except api.step.InfraFailure:
was_infra_failure = True
except api.step.StepFailure: # pragma: no cover
assert False, 'impossible'
assert was_infra_failure is True
def GenTests(api):
yield (
api.test('basic')
+ api.step_data('boom', retcode=1)
+ api.step_data('boom 2', retcode=1)
)