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

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

Issue 2909983003: [loader] Make recipe engine support examples/ module subdir (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « recipe_engine/unittests/run_test.py ('k') | recipe_modules/context/example.expected/basic.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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, config
6
7 DEPS = [
8 'context',
9 'path',
10 'step',
11 ]
12
13
14 def RunSteps(api):
15 api.step('default step', ['bash', '-c', 'echo default!'])
16
17 noop_context = {}
18 with api.context(**noop_context):
19 # nothing happens! this is exactly the same as above, but this optimization
20 # is helpful when recipes need to calculate contextual values.
21 api.step('default step', ['bash', '-c', 'echo default!'])
22
23 # can change cwd
24 api.step('mk subdir', ['mkdir', 'subdir'])
25 with api.context(cwd=api.path['start_dir'].join('subdir')):
26 api.step('subdir step', ['bash', '-c', 'pwd'])
27 api.step('other subdir step', ['bash', '-c', 'echo hi again!'])
28
29 # can set envvars
30 with api.context(env={"HELLO": "WORLD", "HOME": None}):
31 api.step('env step', ['bash', '-c', 'echo $HELLO; echo $HOME'])
32
33 # can increment nest level... note that this is a low level api, prefer
34 # api.step.nest instead:
35 # YES:
36 with api.step.nest('nested'):
37 api.step('properly indented', ['bash', '-c', 'echo yay!'])
38 # AVOID:
39 with api.context(increment_nest_level=True):
40 api.step('indented with wrong name', ['bash', '-c', 'echo indent?'])
41
42
43 def GenTests(api):
44 yield api.test('basic')
OLDNEW
« no previous file with comments | « recipe_engine/unittests/run_test.py ('k') | recipe_modules/context/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698