def testFilterDependencyErrors(self): """Verify that dependency errors are correctly filtered out.""" failures = [cros_patch.ApplyPatchException(x) for x in self.GetPatches(2)] failures += [cros_patch.DependencyError(x, y) for x, y in zip(self.GetPatches(2), failures)] failures[0].patch.approval_timestamp = time.time() failures[-1].patch.approval_timestamp = time.time() self.mox.ReplayAll() result = validation_pool.ValidationPool._FilterDependencyErrors(failures) self.assertEquals(set(failures[:-1]), set(result)) self.mox.VerifyAll()
def f(self, parent, *args, **kwargs): try: return functor(self, parent, *args, **kwargs) except gerrit.GerritException as e: if isinstance(e, gerrit.QueryNotSpecific): e = ( '%s\nSuggest you use gerrit numbers instead (prefixed with a ' "'chrome-internal:' if it's an internal change)." % e) new_exc = cros_patch.PatchException(parent, e) six.reraise(new_exc.__class__, new_exc, sys.exc_info()[2]) except cros_patch.PatchException as e: if e.patch.id == parent.id: raise new_exc = cros_patch.DependencyError(parent, e) six.reraise(new_exc.__class__, new_exc, sys.exc_info()[2])