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

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

Issue 2672593002: raw_io module: Add text_input and text_output (Closed)
Patch Set: Add comment about no cover Created 3 years, 10 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') | recipe_modules/shutil/api.py » ('j') | 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 LUCI Authors. All rights reserved. 1 # Copyright 2015 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be 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, name=None): 10 def output(data, retcode=None, name=None):
11 return data, retcode, name 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_text(data, retcode=None, name=None):
16 return data, retcode, name
17
18 @recipe_test_api.placeholder_step_data
19 @staticmethod
15 def output_dir(files_dict, retcode=None, name=None): 20 def output_dir(files_dict, retcode=None, name=None):
16 assert type(files_dict) is dict 21 assert type(files_dict) is dict
17 assert all(type(key) is str for key in files_dict.keys()) 22 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()) 23 assert all(type(value) is str for value in files_dict.values())
19 return files_dict, retcode, name 24 return files_dict, retcode, name
20 25
21 def stream_output(self, data, stream='stdout', retcode=None, name=None): 26 def stream_output(self, data, stream='stdout', retcode=None, name=None):
22 ret = recipe_test_api.StepTestData() 27 ret = recipe_test_api.StepTestData()
23 assert stream in ('stdout', 'stderr') 28 assert stream in ('stdout', 'stderr')
24 step_data = self.output(data, retcode=retcode, name=name) 29 step_data = self.output(data, retcode=retcode, name=name)
25 setattr(ret, stream, step_data.unwrap_placeholder()) 30 setattr(ret, stream, step_data.unwrap_placeholder())
26 if retcode: 31 if retcode:
27 ret.retcode = retcode 32 ret.retcode = retcode
28 return ret 33 return ret
OLDNEW
« no previous file with comments | « recipe_modules/raw_io/example.expected/basic.json ('k') | recipe_modules/shutil/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698