|
|
@ -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')
|
|
|
|
|
|
|
|
|