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

Unified Diff: recipe_modules/json/test_api.py

Issue 2750793002: [json] improve output to get leak_to and better logging. (Closed)
Patch Set: fixit Created 3 years, 9 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/json/example.resources/cool_script.py ('k') | recipe_modules/raw_io/api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/json/test_api.py
diff --git a/recipe_modules/json/test_api.py b/recipe_modules/json/test_api.py
index 22b9ffbf993e5b1cd337a092efa2dd8044c1b223..e260238a82aaaac0d8235923dcc271c1fd8fc996 100644
--- a/recipe_modules/json/test_api.py
+++ b/recipe_modules/json/test_api.py
@@ -10,8 +10,22 @@ class JsonTestApi(recipe_test_api.RecipeTestApi):
@recipe_test_api.placeholder_step_data
@staticmethod
def output(data, retcode=None, name=None):
+ """Supplies placeholder data for a json.output. `data` should be a jsonish
+ python object (e.g. dict, list, str, bool, int, etc). It will be dumped out
+ with json.dumps and the step will be observed to return that dumped value.
+ """
return json.dumps(data), retcode, name
+ def invalid(self, raw_data_str, retcode=None, name=None):
+ """Can be used to supply data for a json.output, except that it takes a raw
+ string rather than a json object."""
+ ret = recipe_test_api.StepTestData()
+ ret.retcode=retcode
+ placeholder_data = recipe_test_api.PlaceholderTestData(
+ data=raw_data_str, name=name)
+ ret.placeholder_data[(self._module.NAME, 'output', name)] = placeholder_data
+ return ret
+
def output_stream(self, data, stream='stdout', retcode=None, name=None):
assert stream in ('stdout', 'stderr')
ret = recipe_test_api.StepTestData()
« no previous file with comments | « recipe_modules/json/example.resources/cool_script.py ('k') | recipe_modules/raw_io/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698