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

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

Issue 2249163006: raw_io: fix passing retcode in test_api.stream_output (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | 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 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_dir(files_dict, retcode=None, name=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, name 19 return files_dict, retcode, name
20 20
21 def stream_output(self, data, stream='stdout', retcode=None, name=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 step_data = self.output(data, retcode=retcode, name=name) 24 step_data = self.output(data, retcode=retcode, name=name)
25 setattr(ret, stream, step_data.unwrap_placeholder()) 25 setattr(ret, stream, step_data.unwrap_placeholder())
26 if retcode:
27 ret.retcode = retcode
26 return ret 28 return ret
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698