def setUp2(self, _=None): workermanager.TASK_TIMEOUT = 3 self.wm = workermanager.WorkerManager() self.sched = FIFOScheduler(self.wm) self.taskm = taskmanager.TaskManager(self.db, self.wm, self.sched) # Normally added by startService() self.wm.notifyOnNewWorker(lambda name: self.taskm._tryExecute()) factory = self.wm.makeFactory() self.port = reactor.listenTCP(0, factory, interface='127.0.0.1') self.addCleanup(self.port.stopListening)
def _prepare_svc(self): self.app = Application('test') self.workerm = workermanager.WorkerManager() self.sched = FIFOScheduler(self.workerm) self.taskm = taskmanager.TaskManager(self.db_path, self.workerm, self.sched) # HACK: tests needs clear twisted's reactor, so we're mocking # method that creates additional deferreds. self.taskm.database.start_periodic_sync = lambda: None for tid, env in self.SAVED_TASKS: self.taskm.database.update(tid, env) return self.taskm.startService()
def setUp2(self, _=None): self.wm = workermanager.WorkerManager() self.wm.notifyOnNewWorker(self._notify_cb) self.worker_proto = TestWorker() return self.wm.newWorker('unique1', self.worker_proto)