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

Unified Diff: recipes/bottom.py

Issue 1421843006: Add simple depends_on API. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Made it do properties and multi Created 5 years, 1 month 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: recipes/bottom.py
diff --git a/recipes/bottom.py b/recipes/bottom.py
new file mode 100644
index 0000000000000000000000000000000000000000..207f2d12d4b7e7fe2069e826ed2febefcb687898
--- /dev/null
+++ b/recipes/bottom.py
@@ -0,0 +1,33 @@
+from recipe_engine.recipe_api import Property
luqui 2015/11/16 20:48:00 Seems like these should be in recipes/engine_tests
martiniss 2015/11/18 01:00:00 Sure, that's fine. Moved.
+from recipe_engine import config
+
+DEPS = [
+ 'raw_io',
+ 'recipe_engine/properties',
+ 'step',
+]
+
+PROPERTIES = {
+ 'number': Property(kind=int),
+}
+
+RETURN_SCHEMA = config.ReturnSchema(
+ number_times_two=config.Single(int),
+)
+
+def RunSteps(api, number):
+ # Newline cause bc complains if it doesn't have it
+ num_s = '%s*%s\n' % (number, 2)
+ result = api.step(
+ 'calc it', ['bc'],
+ stdin=api.raw_io.input(data=num_s),
+ stdout=api.raw_io.output('out'))
+ return RETURN_SCHEMA(number_times_two=int(result.stdout))
+
+def GenTests(api):
+ yield (
+ api.test('basic') +
+ api.properties(number=3) +
+ api.step_data('calc it',
+ stdout=api.raw_io.output('6'))
+ )
« recipe_engine/run.py ('K') | « recipes.py ('k') | recipes/bottom.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698