def test_terminate__task_started(self): pool = Mock() tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"}) tw.time_start = time.time() tw.worker_pid = 313 tw.terminate(pool, signal="KILL") pool.terminate_job.assert_called_with(tw.worker_pid, "KILL")
def test_terminate__task_started(self): pool = Mock() signum = signal.SIGKILL tw = TaskRequest(mytask.name, uuid(), [1], {"f": "x"}) with assert_signal_called(task_revoked, sender=tw.task, terminated=True, expired=False, signum=signum): tw.time_start = time.time() tw.worker_pid = 313 tw.terminate(pool, signal="KILL") pool.terminate_job.assert_called_with(tw.worker_pid, signum)
def test_terminate__task_started(self): pool = Mock() signum = signal.SIGKILL job = TaskRequest(self.mytask.name, uuid(), [1], {"f": "x"}, app=self.app) with assert_signal_called( task_revoked, sender=job.task, request=job, terminated=True, expired=False, signum=signum ): job.time_start = time.time() job.worker_pid = 313 job.terminate(pool, signal="KILL") pool.terminate_job.assert_called_with(job.worker_pid, signum)
def test_terminate__task_started(self): pool = Mock() signum = signal.SIGKILL tw = TaskRequest(mytask.name, uuid(), [1], {'f': 'x'}) with assert_signal_called(task_revoked, sender=tw.task, terminated=True, expired=False, signum=signum): tw.time_start = time.time() tw.worker_pid = 313 tw.terminate(pool, signal='KILL') pool.terminate_job.assert_called_with(tw.worker_pid, signum)