| Index: recipe_modules/context/examples/full.py
|
| diff --git a/recipe_modules/context/examples/full.py b/recipe_modules/context/examples/full.py
|
| index 3f876960cfca14a924048f44613e000450c02914..d6b515c6364ada76ecae444360b504d86c9f2738 100644
|
| --- a/recipe_modules/context/examples/full.py
|
| +++ b/recipe_modules/context/examples/full.py
|
| @@ -7,6 +7,7 @@ from recipe_engine import recipe_api, config
|
| DEPS = [
|
| 'context',
|
| 'path',
|
| + 'raw_io',
|
| 'step',
|
| ]
|
|
|
| @@ -27,14 +28,29 @@ def RunSteps(api):
|
| api.step('other subdir step', ['bash', '-c', 'echo hi again!'])
|
|
|
| # can set envvars, and path prefix.
|
| + pants = api.path['start_dir'].join('pants')
|
| + shirt = api.path['start_dir'].join('shirt')
|
| with api.context(env={'FOO': 'bar'}):
|
| api.step('env step', ['bash', '-c', 'echo $FOO'])
|
|
|
| - pants = api.path['start_dir'].join('pants')
|
| - shirt = api.path['start_dir'].join('shirt')
|
| - with api.context(env={'FOO': api.context.Prefix(pants, shirt)}):
|
| - api.step('env step with prefix',
|
| - ['bash', '-c', 'echo $FOO'])
|
| + with api.context(env_prefixes={'FOO': [pants, shirt]}):
|
| + expected = api.path.pathsep.join([str(pants), str(shirt), 'bar'])
|
| + result = api.step('env step with prefix',
|
| + ['bash', '-c', 'echo $FOO'],
|
| + stdout=api.raw_io.output(),
|
| + step_test_data=lambda: (
|
| + api.raw_io.test_api.stream_output(expected)))
|
| + assert result.stdout.strip() == expected
|
| +
|
| + # Path prefix won't append empty environment variables.
|
| + with api.context(env={'FOO': ''}, env_prefixes={'FOO': [pants, shirt]}):
|
| + expected = api.path.pathsep.join([str(pants), str(shirt)])
|
| + result = api.step('env prefixes with empty value',
|
| + ['bash', '-c', 'echo $FOO'],
|
| + stdout=api.raw_io.output(),
|
| + step_test_data=lambda: (
|
| + api.raw_io.test_api.stream_output(expected)))
|
| + assert result.stdout.strip() == expected
|
|
|
| # %-formats are errors (for now). Double-% escape them.
|
| bad_examples = ['%format', '%s']
|
|
|