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

Unified Diff: recipe_modules/step/example.py

Issue 1344583003: Recipe package system. (Closed) Base URL: git@github.com:luci/recipes-py.git@master
Patch Set: Recompiled proto Created 5 years, 3 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/__init__.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 2eaf220fbce1a514b0d11bd6814c7994d38a848b..882caab98826411ac88685b998087deab0a9b57f 100644
--- a/recipe_modules/step/example.py
+++ b/recipe_modules/step/example.py
@@ -3,8 +3,8 @@
# found in the LICENSE file.
DEPS = [
- 'properties',
- 'step',
+ 'recipe_engine/properties',
+ 'recipe_engine/step',
]
from recipe_engine import recipe_api
@@ -35,9 +35,17 @@ def RunSteps(api):
api.step('goodbye', ['echo', 'goodbye'])
# Modifying step_result now would raise an AssertionError.
except api.step.StepFailure:
- # Raising anything besides StepFailure causes the build to go purple.
+ # Raising anything besides StepFailure or StepWarning causes the build to go
+ # purple.
raise ValueError('goodbye must exit 0!')
+ try:
+ api.step('warning', ['echo', 'warning'])
+ except api.step.StepFailure as e:
+ e.result.presentation.status = api.step.WARNING
+ raise api.step.StepWarning(e.message)
+
+
# Aggregate failures from tests!
try:
with recipe_api.defer_results():
@@ -56,17 +64,13 @@ def RunSteps(api):
# Run a step through a made-up wrapper program.
api.step('application', ['echo', 'main', 'application'],
- wrapper=['python', 'test-wrapper.py', '-v', '--'])
+ wrapper=['python', '-c', 'import sys; print sys.argv'])
if api.properties.get('access_invalid_data'):
result = api.step('no-op', ['echo', 'I', 'do', 'nothing'])
# Trying to access non-existent attributes on the result should raise.
_ = result.json.output
- # You can also raise a warning, which will act like a step failure, but
- # will turn the build yellow, and stop the build.
- raise api.step.StepWarning("Warning, robots approaching!")
-
def GenTests(api):
yield (
@@ -94,6 +98,12 @@ def GenTests(api):
)
yield (
+ api.test('warning') +
+ api.step_data('warning', retcode=1) +
+ api.expect_exception('StepWarning')
+ )
+
+ yield (
api.test('defer_results') +
api.step_data('testa', retcode=1)
)
« no previous file with comments | « recipe_modules/step/__init__.py ('k') | recipe_modules/step/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698