def MakePool(overlays=constants.PUBLIC_OVERLAYS, build_number=1,
             builder_name='foon', is_master=True, dryrun=True, **kwds):
  """Helper for creating ValidationPool objects for tests."""
  kwds.setdefault('changes', [])
  build_root = kwds.pop('build_root', '/fake_root')

  pool = validation_pool.ValidationPool(
      overlays, build_root, build_number, builder_name, is_master,
      dryrun, **kwds)
  return pool
 def _GetTestData(cls):
   ids = [cros_patch.MakeChangeId() for _ in xrange(3)]
   changes = [cls._GetCrosInternalPatch(GetTestJson(ids[0]))]
   non_os = [cls._GetCrosPatch(GetTestJson(ids[1]))]
   conflicting = [cls._GetCrosInternalPatch(GetTestJson(ids[2]))]
   conflicting = [cros_patch.PatchException(x)for x in conflicting]
   pool = validation_pool.ValidationPool(
       constants.PUBLIC_OVERLAYS,
       '/fake/pathway', 1,
       'testing', True, True,
       changes=changes, non_os_changes=non_os,
       conflicting_changes=conflicting)
   return pickle.dumps([pool, changes, non_os, conflicting])
Esempio n. 3
0
    def MakePool(self,
                 overlays=constants.PUBLIC_OVERLAYS,
                 build_number=1,
                 builder_name='foon',
                 is_master=True,
                 dryrun=True,
                 **kwds):
        handlers = kwds.pop('handlers', False)
        kwds.setdefault('helper_pool',
                        validation_pool.HelperPool.SimpleCreate())
        kwds.setdefault('changes', [])

        pool = validation_pool.ValidationPool(overlays, self.build_root,
                                              build_number, builder_name,
                                              is_master, dryrun, **kwds)
        self.mox.StubOutWithMock(pool, '_SendNotification')
        if handlers:
            self.mox.StubOutWithMock(pool, '_HandleApplySuccess')
            self.mox.StubOutWithMock(pool, '_HandleApplyFailure')
            self.mox.StubOutWithMock(pool, '_HandleCouldNotApply')
        self.mox.StubOutWithMock(pool, '_patch_series')
        return pool