| OLD | NEW |
| 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 |
| OLD | NEW |