OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 | 1160 |
1161 def add_expectations_from_bot(self): | 1161 def add_expectations_from_bot(self): |
1162 # FIXME: With mode 'very-flaky' and 'maybe-flaky', this will show the ex
pectations entry in the flakiness | 1162 # FIXME: With mode 'very-flaky' and 'maybe-flaky', this will show the ex
pectations entry in the flakiness |
1163 # dashboard rows for each test to be whatever the bot thinks they should
be. Is this a good thing? | 1163 # dashboard rows for each test to be whatever the bot thinks they should
be. Is this a good thing? |
1164 bot_expectations = self._port.bot_expectations() | 1164 bot_expectations = self._port.bot_expectations() |
1165 model = TestExpectationsModel(self._shorten_filename) | 1165 model = TestExpectationsModel(self._shorten_filename) |
1166 for test_name in bot_expectations: | 1166 for test_name in bot_expectations: |
1167 expectation_line = self._parser.expectation_line_for_test(test_name,
bot_expectations[test_name]) | 1167 expectation_line = self._parser.expectation_line_for_test(test_name,
bot_expectations[test_name]) |
1168 | 1168 |
1169 # Unexpected results are merged into existing expectations. | 1169 # Unexpected results are merged into existing expectations. |
1170 merge = self._port.get_option('ignore_flaky_tests') == 'unexpected' | |
1171 model.add_expectation_line(expectation_line) | 1170 model.add_expectation_line(expectation_line) |
1172 self._model.merge_model(model) | 1171 self._model.merge_model(model) |
1173 | 1172 |
1174 def add_expectation_line(self, expectation_line): | 1173 def add_expectation_line(self, expectation_line): |
1175 self._model.add_expectation_line(expectation_line) | 1174 self._model.add_expectation_line(expectation_line) |
1176 self._expectations += [expectation_line] | 1175 self._expectations += [expectation_line] |
1177 | 1176 |
1178 def remove_expectation_line(self, test): | 1177 def remove_expectation_line(self, test): |
1179 if not self._model.has_test(test): | 1178 if not self._model.has_test(test): |
1180 return | 1179 return |
1181 self._expectations.remove(self._model.get_expectation_line(test)) | 1180 self._expectations.remove(self._model.get_expectation_line(test)) |
1182 self._model.remove_expectation_line(test) | 1181 self._model.remove_expectation_line(test) |
1183 | 1182 |
1184 @staticmethod | 1183 @staticmethod |
1185 def list_to_string(expectation_lines, test_configuration_converter=None, rec
onstitute_only_these=None): | 1184 def list_to_string(expectation_lines, test_configuration_converter=None, rec
onstitute_only_these=None): |
1186 def serialize(expectation_line): | 1185 def serialize(expectation_line): |
1187 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. | 1186 # If reconstitute_only_these is an empty list, we want to return ori
ginal_string. |
1188 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. | 1187 # So we need to compare reconstitute_only_these to None, not just ch
eck if it's falsey. |
1189 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: | 1188 if reconstitute_only_these is None or expectation_line in reconstitu
te_only_these: |
1190 return expectation_line.to_string(test_configuration_converter) | 1189 return expectation_line.to_string(test_configuration_converter) |
1191 return expectation_line.original_string | 1190 return expectation_line.original_string |
1192 | 1191 |
1193 def nones_out(expectation_line): | 1192 def nones_out(expectation_line): |
1194 return expectation_line is not None | 1193 return expectation_line is not None |
1195 | 1194 |
1196 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) | 1195 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) |
OLD | NEW |