Exemple #1
0
 def test_spawnWorkers_calls__spawnWorker_for_missing_workers(self):
     worker_count = random.randint(2, 16)
     service = WorkersService(reactor, worker_count=worker_count)
     self.patch(service, '_spawnWorker')
     pid = random.randint(1, 500)
     service.workers[pid] = {}
     service.spawnWorkers()
     self.assertEquals(worker_count - 1, service._spawnWorker.call_count)
Exemple #2
0
 def test_spawnWorkers_calls__spawnWorker_for_missing_workers(self):
     worker_count = random.randint(2, 16)
     service = WorkersService(reactor, worker_count=worker_count)
     self.patch(service, "_spawnWorker")
     pid = random.randint(1, 500)
     service.workers[pid] = WorkerProcess(service)
     service.spawnWorkers()
     calls = [call(runningImport=True)
              ] + [call() for _ in range(worker_count - 2)]
     self.assertThat(service._spawnWorker, MockCallsMatch(*calls))