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

Unified Diff: recipe_modules/step/example.py

Issue 2886903004: Revert of [recipe_modules/step] do not set cwd if it is start_dir. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « recipe_modules/step/api.py ('k') | recipe_modules/step/example.expected/basic.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/step/example.py
diff --git a/recipe_modules/step/example.py b/recipe_modules/step/example.py
index bd550c9f2f0fe6e5b1932cca6f94addb4ff877ba..3f7c69d81bf445f7612828a685644d229808dca7 100644
--- a/recipe_modules/step/example.py
+++ b/recipe_modules/step/example.py
@@ -18,12 +18,14 @@
PROPERTIES = {
'bad_return': recipe_api.Property(default=False),
+ 'raise_infra_failure': recipe_api.Property(default=False),
'access_invalid_data': recipe_api.Property(default=False),
'timeout': recipe_api.Property(default=0, kind=int),
}
-def RunSteps(api, bad_return, access_invalid_data, timeout):
+def RunSteps(
+ api, bad_return, raise_infra_failure, access_invalid_data, timeout):
if bad_return:
return RETURN_SCHEMA.new(test_me='this should fail')
elif timeout:
@@ -42,17 +44,6 @@
# The api.step object is directly callable.
api.step('hello', ['echo', 'Hello World'])
api.step('hello', ['echo', 'Why hello, there.'])
-
- # You can change the current working directory as well
- api.step('mk subdir', ['mkdir', 'something'])
- with api.step.context({'cwd': api.path['start_dir'].join('something')}):
- api.step('something', ['bash', '-c', 'echo Why hello, there, in a subdir.'])
-
- # By default, all steps run in 'start_dir', or the cwd of the recipe engine
- # when the recipe begins. Because of this, setting cwd to start_dir doesn't
- # show anything in particular in the expectations.
- with api.step.context({'cwd': api.path['start_dir']}):
- api.step('start_dir ignored', ['bash', '-c', 'echo what happen'])
# You can also manipulate various aspects of the step, such as env.
# These are passed straight through to subprocess.Popen.
@@ -84,7 +75,7 @@
api.step('goodbye', ['echo', 'goodbye'])
# Modifying step_result now would raise an AssertionError.
except api.step.StepFailure:
- # Raising anything besides StepFailure or StepWarning causes the build to go
+ # Raising anything besides StepFailure or StepWarning causes the build to go
# purple.
raise ValueError('goodbye must exit 0!')
@@ -166,6 +157,7 @@
yield (
api.test('infra_failure') +
+ api.properties(raise_infra_failure=True) +
api.step_data('cleanup', retcode=1)
)
« no previous file with comments | « recipe_modules/step/api.py ('k') | recipe_modules/step/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698