def create_expected(test_manifest, test_path, tests): expected = manifestupdate.ExpectedManifest(None, test_path, test_manifest.url_base) for test in tests: expected.append(manifestupdate.TestNode.create(test.item_type, test.id)) return expected
def create_expected(test_manifest, test_path, tests, property_order=None, boolean_properties=None): expected = manifestupdate.ExpectedManifest(None, test_path, test_manifest.url_base, property_order=property_order, boolean_properties=boolean_properties) for test in tests: expected.append(manifestupdate.TestNode.create(test.id)) return expected
def create_expected(test_manifest, test_path, tests, property_order=None, boolean_properties=None): expected = manifestupdate.ExpectedManifest(None, test_path, test_manifest.url_base, property_order=property_order, boolean_properties=boolean_properties) for test in tests: expected.append(manifestupdate.TestNode.create(test.item_type, test.id)) return expected
def updated_value(self, current, new): if len(new) > 1 and not self.update_intermittent and not isinstance( current, list): raise ConditionError counts = {} for status, count in new.iteritems(): if isinstance(status, tuple): counts[status[0]] = count counts.update({ intermittent: 0 for intermittent in status[1:] if intermittent not in counts }) else: counts[status] = count if not (self.update_intermittent or isinstance(current, list)): return list(counts)[0] # Reorder statuses first based on counts, then based on status priority if there are ties. # Counts with 0 are considered intermittent. statuses = ["OK", "PASS", "FAIL", "ERROR", "TIMEOUT", "CRASH"] status_priority = {value: i for i, value in enumerate(statuses)} sorted_new = sorted( counts.iteritems(), key=lambda x: (-1 * x[1], status_priority.get(x[0], len(status_priority)))) expected = [] for status, count in sorted_new: # If we are not removing existing recorded intermittents, with a count of 0, # add them in to expected. if count > 0 or not self.remove_intermittent: expected.append(status) if self.update_intermittent: if len(expected) == 1: return expected[0] return expected # If nothing has changed and not self.update_intermittent, preserve existing # intermittent. if set(expected).issubset(set(current)): return current # If we are not updating intermittents, return the status with the highest occurence. return expected[0]
def create_expected(test_path, tests): expected = manifestupdate.ExpectedManifest(None, test_path) for test in tests: expected.append(manifestupdate.TestNode.create(test.item_type, test.id)) return expected