Renamed to SimpleWorker

main
foxx 10 years ago
parent 23cae3a420
commit 52c3ad0fbf

@ -7,7 +7,7 @@ from .connections import (Connection, get_current_connection, pop_connection,
from .job import cancel_job, get_current_job, requeue_job from .job import cancel_job, get_current_job, requeue_job
from .queue import get_failed_queue, Queue from .queue import get_failed_queue, Queue
from .version import VERSION from .version import VERSION
from .worker import Worker, WorkerTest from .worker import Worker, SimpleWorker
__all__ = [ __all__ = [
'use_connection', 'get_current_connection', 'use_connection', 'get_current_connection',

@ -559,7 +559,7 @@ class Worker(object):
"""Pops the latest exception handler off of the exc handler stack.""" """Pops the latest exception handler off of the exc handler stack."""
return self._exc_handlers.pop() return self._exc_handlers.pop()
class WorkerTest(Worker): class SimpleWorker(Worker):
def _install_signal_handlers(self, *args, **kwargs): def _install_signal_handlers(self, *args, **kwargs):
"""Signal handlers are useless for test worker, as it """Signal handlers are useless for test worker, as it
does not have fork() ability""" does not have fork() ability"""

@ -4,7 +4,7 @@ from __future__ import (absolute_import, division, print_function,
import os import os
from rq import get_failed_queue, Queue, Worker, WorkerTest from rq import get_failed_queue, Queue, Worker, SimpleWorker
from rq.compat import as_text from rq.compat import as_text
from rq.job import Job, Status from rq.job import Job, Status
@ -278,11 +278,11 @@ class TestWorker(RQTestCase):
worker = Worker([q], job_class=CustomJob) worker = Worker([q], job_class=CustomJob)
self.assertEqual(worker.job_class, CustomJob) self.assertEqual(worker.job_class, CustomJob)
def test_work_via_workertest(self): def test_work_via_simpleworker(self):
"""Worker processes work, with forking disabled, """Worker processes work, with forking disabled,
then returns.""" then returns."""
fooq, barq = Queue('foo'), Queue('bar') fooq, barq = Queue('foo'), Queue('bar')
w = WorkerTest([fooq, barq]) w = SimpleWorker([fooq, barq])
self.assertEquals(w.work(burst=True), False, self.assertEquals(w.work(burst=True), False,
'Did not expect any work on the queue.') 'Did not expect any work on the queue.')
@ -291,4 +291,3 @@ class TestWorker(RQTestCase):
'Expected at least some work done.') 'Expected at least some work done.')
self.assertEquals(job.result, os.getpid(), self.assertEquals(job.result, os.getpid(),
'PID mismatch, fork() is not supposed to happen here') 'PID mismatch, fork() is not supposed to happen here')
Loading…
Cancel
Save