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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

Issue 2119303003: Create the harness and shell of update_test_expectations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@updateTestExpectations1
Patch Set: Addressed Quinten's comments Created 4 years, 5 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
OLDNEW
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 result.expectations = list(set(line1.expectations) | set(line2.expectati ons)) 481 result.expectations = list(set(line1.expectations) | set(line2.expectati ons))
482 result.bugs = list(set(line1.bugs) | set(line2.bugs)) 482 result.bugs = list(set(line1.bugs) | set(line2.bugs))
483 result.specifiers = list(set(line1.specifiers) | set(line2.specifiers)) 483 result.specifiers = list(set(line1.specifiers) | set(line2.specifiers))
484 result.parsed_specifiers = list(set(line1.parsed_specifiers) | set(line2 .parsed_specifiers)) 484 result.parsed_specifiers = list(set(line1.parsed_specifiers) | set(line2 .parsed_specifiers))
485 result.matching_configurations = set(line1.matching_configurations) | se t(line2.matching_configurations) 485 result.matching_configurations = set(line1.matching_configurations) | se t(line2.matching_configurations)
486 result.matching_tests = list(list(set(line1.matching_tests) | set(line2. matching_tests))) 486 result.matching_tests = list(list(set(line1.matching_tests) | set(line2. matching_tests)))
487 result.warnings = list(set(line1.warnings) | set(line2.warnings)) 487 result.warnings = list(set(line1.warnings) | set(line2.warnings))
488 result.is_skipped_outside_expectations_file = line1.is_skipped_outside_e xpectations_file or line2.is_skipped_outside_expectations_file 488 result.is_skipped_outside_expectations_file = line1.is_skipped_outside_e xpectations_file or line2.is_skipped_outside_expectations_file
489 return result 489 return result
490 490
491 def to_string(self, test_configuration_converter, include_specifiers=True, i nclude_expectations=True, include_comment=True): 491 def to_string(self, test_configuration_converter=None, include_specifiers=Tr ue, include_expectations=True, include_comment=True):
492 parsed_expectation_to_string = dict([[parsed_expectation, expectation_st ring] 492 parsed_expectation_to_string = dict([[parsed_expectation, expectation_st ring]
493 for expectation_string, parsed_expe ctation in TestExpectations.EXPECTATIONS.items()]) 493 for expectation_string, parsed_expe ctation in TestExpectations.EXPECTATIONS.items()])
494 494
495 if self.is_invalid(): 495 if self.is_invalid():
496 return self.original_string or '' 496 return self.original_string or ''
497 497
498 if self.name is None: 498 if self.name is None:
499 return '' if self.comment is None else "#%s" % self.comment 499 return '' if self.comment is None else "#%s" % self.comment
500 500
501 if test_configuration_converter and self.bugs: 501 if test_configuration_converter and self.bugs:
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 1030
1031 self._has_warnings = False 1031 self._has_warnings = False
1032 self._report_warnings() 1032 self._report_warnings()
1033 self._process_tests_without_expectations() 1033 self._process_tests_without_expectations()
1034 1034
1035 # TODO(ojan): Allow for removing skipped tests when getting the list of 1035 # TODO(ojan): Allow for removing skipped tests when getting the list of
1036 # tests to run, but not when getting metrics. 1036 # tests to run, but not when getting metrics.
1037 def model(self): 1037 def model(self):
1038 return self._model 1038 return self._model
1039 1039
1040 def expectations(self):
1041 return self._expectations
1042
1040 def get_needs_rebaseline_failures(self): 1043 def get_needs_rebaseline_failures(self):
1041 return self._model.get_test_set(NEEDS_REBASELINE) 1044 return self._model.get_test_set(NEEDS_REBASELINE)
1042 1045
1043 def get_rebaselining_failures(self): 1046 def get_rebaselining_failures(self):
1044 return self._model.get_test_set(REBASELINE) 1047 return self._model.get_test_set(REBASELINE)
1045 1048
1046 # FIXME: Change the callsites to use TestExpectationsModel and remove. 1049 # FIXME: Change the callsites to use TestExpectationsModel and remove.
1047 def get_expectations(self, test): 1050 def get_expectations(self, test):
1048 return self._model.get_expectations(test) 1051 return self._model.get_expectations(test)
1049 1052
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. 1190 # 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. 1191 # 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: 1192 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these:
1190 return expectation_line.to_string(test_configuration_converter) 1193 return expectation_line.to_string(test_configuration_converter)
1191 return expectation_line.original_string 1194 return expectation_line.original_string
1192 1195
1193 def nones_out(expectation_line): 1196 def nones_out(expectation_line):
1194 return expectation_line is not None 1197 return expectation_line is not None
1195 1198
1196 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) 1199 return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698