| OLD | NEW |
| 1 import json | 1 import json |
| 2 | 2 |
| 3 from recipe_engine import recipe_test_api | 3 from recipe_engine import recipe_test_api |
| 4 | 4 |
| 5 from .util import GTestResults, TestResults | 5 from .util import GTestResults, TestResults |
| 6 | 6 |
| 7 class TestUtilsTestApi(recipe_test_api.RecipeTestApi): | 7 class TestUtilsTestApi(recipe_test_api.RecipeTestApi): |
| 8 @recipe_test_api.placeholder_step_data | 8 @recipe_test_api.placeholder_step_data |
| 9 def test_results(self, test_results, retcode=None): | 9 def test_results(self, test_results, retcode=None): |
| 10 return self.m.json.output(test_results.as_jsonish(), retcode) | 10 return self.m.json.output(test_results.as_jsonish(), retcode) |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 swarming_path = '0\\results.json' if is_win else '0/results.json' | 142 swarming_path = '0\\results.json' if is_win else '0/results.json' |
| 143 results_path = swarming_path if swarming else 'results.json' | 143 results_path = swarming_path if swarming else 'results.json' |
| 144 files_dict = { | 144 files_dict = { |
| 145 results_path: json.dumps(jsonish_results), | 145 results_path: json.dumps(jsonish_results), |
| 146 'summary.json': json.dumps(jsonish_summary) | 146 'summary.json': json.dumps(jsonish_summary) |
| 147 } | 147 } |
| 148 return self.m.raw_io.output_dir(files_dict) | 148 return self.m.raw_io.output_dir(files_dict) |
| 149 | 149 |
| 150 def canned_isolated_script_output(self, passing, is_win, swarming=False, |
| 151 swarming_internal_failure=False, |
| 152 isolated_script_passing=True, valid=True): |
| 153 """Produces a test results' compatible json for isolated script tests. """ |
| 154 jsonish_results = {} |
| 155 jsonish_results['valid'] = valid |
| 156 if isolated_script_passing: |
| 157 jsonish_results['failures'] = [] |
| 158 else: |
| 159 jsonish_results['failures'] = ['test1.Test1', 'test2.Test2'] |
| 160 |
| 161 jsonish_summary = { |
| 162 'shards': [ |
| 163 { |
| 164 'failure': not passing, |
| 165 'internal_failure': swarming_internal_failure |
| 166 } |
| 167 ] |
| 168 } |
| 169 |
| 170 swarming_path = '0\\output.json' if is_win else '0/output.json' |
| 171 results_path = swarming_path if swarming else 'output.json' |
| 172 files_dict = { |
| 173 results_path: json.dumps(jsonish_results), |
| 174 'summary.json': json.dumps(jsonish_summary) |
| 175 } |
| 176 return self.m.raw_io.output_dir(files_dict) |
| OLD | NEW |