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

Side by Side Diff: recipe_modules/raw_io/test_api.py

Issue 1773273003: Make output placeholders like json.output index-able by name. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Rebase. Created 4 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 unified diff | Download patch
« no previous file with comments | « recipe_modules/raw_io/example.expected/basic.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from recipe_engine import recipe_test_api 5 from recipe_engine import recipe_test_api
6 6
7 class RawIOTestApi(recipe_test_api.RecipeTestApi): # pragma: no cover 7 class RawIOTestApi(recipe_test_api.RecipeTestApi): # pragma: no cover
8 @recipe_test_api.placeholder_step_data 8 @recipe_test_api.placeholder_step_data
9 @staticmethod 9 @staticmethod
10 def output(data, retcode=None): 10 def output(data, retcode=None, name=None):
11 return data, retcode 11 return data, retcode, name
12 12
13 @recipe_test_api.placeholder_step_data 13 @recipe_test_api.placeholder_step_data
14 @staticmethod 14 @staticmethod
15 def output_dir(files_dict, retcode=None): 15 def output_dir(files_dict, retcode=None, name=None):
16 assert type(files_dict) is dict 16 assert type(files_dict) is dict
17 assert all(type(key) is str for key in files_dict.keys()) 17 assert all(type(key) is str for key in files_dict.keys())
18 assert all(type(value) is str for value in files_dict.values()) 18 assert all(type(value) is str for value in files_dict.values())
19 return files_dict, retcode 19 return files_dict, retcode, name
20 20
21 def stream_output(self, data, stream='stdout', retcode=None): 21 def stream_output(self, data, stream='stdout', retcode=None, name=None):
22 ret = recipe_test_api.StepTestData() 22 ret = recipe_test_api.StepTestData()
23 assert stream in ('stdout', 'stderr') 23 assert stream in ('stdout', 'stderr')
24 setattr(ret, stream, self.output(data, retcode).unwrap_placeholder()) 24 step_data = self.output(data, retcode=retcode, name=name)
25 setattr(ret, stream, step_data.unwrap_placeholder())
25 return ret 26 return ret
OLDNEW
« no previous file with comments | « recipe_modules/raw_io/example.expected/basic.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698