def setMinCores(self, minCores): """Sets the minimum amount of cores for the task @type minCores: int @param minCores: the minimum number of cores the task needs""" self.stub.SetMinCores(task_pb2.TaskSetMinCoresRequest( task=self.task, new_min_cores=minCores), timeout=Cuebot.Timeout)
def testSetMinCores(self, getStubMock): stubMock = mock.Mock() stubMock.Save.return_value = task_pb2.TaskSetMinCoresResponse() getStubMock.return_value = stubMock minCores = 10 task = opencue.wrappers.task.Task(task_pb2.Task(name='testTask')) task.setMinCores(minCores) stubMock.SetMinCores.assert_called_with( task_pb2.TaskSetMinCoresRequest(task=task.data, new_min_cores=minCores), timeout=mock.ANY)