OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import sys | 5 import sys |
6 import traceback | 6 import traceback |
7 | 7 |
8 from telemetry import value as value_module | 8 from telemetry import value as value_module |
9 | 9 |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 def AsDict(self): | 74 def AsDict(self): |
75 d = super(FailureValue, self).AsDict() | 75 d = super(FailureValue, self).AsDict() |
76 d['value'] = GetStringFromExcInfo(self.exc_info) | 76 d['value'] = GetStringFromExcInfo(self.exc_info) |
77 return d | 77 return d |
78 | 78 |
79 @staticmethod | 79 @staticmethod |
80 def FromDict(value_dict, page_dict): | 80 def FromDict(value_dict, page_dict): |
81 kwargs = value_module.Value.GetConstructorKwArgs(value_dict, page_dict) | 81 kwargs = value_module.Value.GetConstructorKwArgs(value_dict, page_dict) |
82 del kwargs['name'] | 82 del kwargs['name'] |
83 del kwargs['units'] | 83 del kwargs['units'] |
84 important = kwargs.get('important', None) | 84 if 'important' in kwargs: |
85 if important != None: | |
86 del kwargs['important'] | 85 del kwargs['important'] |
| 86 if 'higher_is_better' in kwargs: |
| 87 del kwargs['higher_is_better'] |
87 kwargs['exc_info'] = FailureValue._GetExcInfoFromMessage( | 88 kwargs['exc_info'] = FailureValue._GetExcInfoFromMessage( |
88 value_dict['value']) | 89 value_dict['value']) |
89 | 90 |
90 return FailureValue(**kwargs) | 91 return FailureValue(**kwargs) |
91 | 92 |
92 @classmethod | 93 @classmethod |
93 def MergeLikeValuesFromSamePage(cls, values): | 94 def MergeLikeValuesFromSamePage(cls, values): |
94 assert False, 'Should not be called.' | 95 assert False, 'Should not be called.' |
95 | 96 |
96 @classmethod | 97 @classmethod |
97 def MergeLikeValuesFromDifferentPages(cls, values, | 98 def MergeLikeValuesFromDifferentPages(cls, values, |
98 group_by_name_suffix=False): | 99 group_by_name_suffix=False): |
99 assert False, 'Should not be called.' | 100 assert False, 'Should not be called.' |
100 | 101 |
101 def GetStringFromExcInfo(exc_info): | 102 def GetStringFromExcInfo(exc_info): |
102 return ''.join(traceback.format_exception(*exc_info)) | 103 return ''.join(traceback.format_exception(*exc_info)) |
OLD | NEW |