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

Unified Diff: recipe_modules/context/tests/env.py

Issue 2925453002: [context] Add path prefix/suffix manipulation. (Closed)
Patch Set: advise 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 side-by-side diff with in-line comments
Download patch
Index: recipe_modules/context/tests/env.py
diff --git a/recipe_modules/context/tests/env.py b/recipe_modules/context/tests/env.py
index 817050a199d4f9ed001d5b2e33e1cedd08fd14e1..961d0e41b119188379a70372e1acb2e8ae3df622 100644
--- a/recipe_modules/context/tests/env.py
+++ b/recipe_modules/context/tests/env.py
@@ -18,6 +18,38 @@ def RunSteps(api):
with api.context(env={"SOMETHING_ELSE": "0"}):
api.step('with 2 envs', ['echo', 'hello'])
+ with api.context(env={'FOO': 'bar'}):
+ api.step('env step', ['bash', '-c', 'echo $FOO'])
+
+ base_path = 'foo%s%%(FOO)s%sbaz' % (api.path.pathsep, api.path.pathsep)
+ with api.context(env={'FOO': base_path}):
+ api.step('env step augmented', ['bash', '-c', 'echo $FOO'])
+
+ pants = api.path['start_dir'].join('pants')
+ shirt = api.path['start_dir'].join('shirt')
+ with api.context.path_prefix('FOO', pants, shirt, pants, shirt):
+ with api.context.path_suffix('FOO', pants, shirt, pants, shirt):
+ api.step('env step with prefix and suffix',
+ ['bash', '-c', 'echo $FOO'])
+
+ with api.context.path_remove('FOO', shirt):
+ api.step('env with path removal',
+ ['bash', '-c', 'echo $FOO'])
+
+ with api.context.path_remove('FOO', pants):
+ api.step('env with full path removal',
+ ['bash', '-c', 'echo $FOO'])
+
+ with api.context(path_prefix={}):
+ api.step('env with empty prefix',
+ ['bash', '-c', 'echo $FOO'])
+
+ # Can set the path of default environment variables.
+ with api.context.path_prefix('FOO', shirt):
+ api.step('env with default value',
+ ['bash', '-c', 'echo $FOO'])
+
+
def GenTests(api):
yield api.test('basic')

Powered by Google App Engine
This is Rietveld 408576698