def test_kill(self): '''Should be able to fall on its sword if need be''' worker = SerialWorker([], self.client) worker.jid = 'foo' thread = Thread(target=worker.kill, args=(worker.jid,)) thread.start() thread.join() self.assertFalse(thread.is_alive())
def test_kill(self): '''Should be able to fall on its sword if need be''' worker = SerialWorker([], self.client) worker.jid = 'foo' thread = Thread(target=worker.kill, args=(worker.jid, )) thread.start() thread.join() self.assertFalse(thread.is_alive())
def jobs(self): '''Yield only a few jobs''' generator = SerialWorker.jobs(self) for _ in range(5): yield next(generator)
def test_shutdown(self): '''We should be able to shutdown a serial worker''' # If this test finishes, it passes worker = SerialWorker([], self.client, interval=0.1) worker.stop() worker.run()
def test_kill_dead(self): '''If we've moved on to another job, say so''' # If this tests runs to completion, it has succeeded worker = SerialWorker([], self.client) worker.kill('foo')