main
Vincent Driessen 13 years ago
parent e807748ee6
commit 91fff48389

@ -17,10 +17,12 @@ class TestWorker(RQTestCase):
"""Worker processes work, then quits.""" """Worker processes work, then quits."""
fooq, barq = Queue('foo'), Queue('bar') fooq, barq = Queue('foo'), Queue('bar')
w = Worker([fooq, barq]) w = Worker([fooq, barq])
self.assertEquals(w.work(burst=True), False, 'Did not expect any work on the queue.') self.assertEquals(w.work(burst=True), False,
'Did not expect any work on the queue.')
fooq.enqueue(say_hello, name='Frank') fooq.enqueue(say_hello, name='Frank')
self.assertEquals(w.work(burst=True), True, 'Expected at least some work done.') self.assertEquals(w.work(burst=True), True,
'Expected at least some work done.')
def test_work_is_unreadable(self): def test_work_is_unreadable(self):
"""Unreadable jobs are put on the failed queue.""" """Unreadable jobs are put on the failed queue."""
@ -79,13 +81,13 @@ class TestWorker(RQTestCase):
job = Job.fetch(job.id) job = Job.fetch(job.id)
self.assertEquals(job.origin, q.name) self.assertEquals(job.origin, q.name)
# should be the original enqueued_at date, not the date of enqueueing to # Should be the original enqueued_at date, not the date of enqueueing
# the failed queue # to the failed queue
self.assertEquals(job.enqueued_at, enqueued_at_date) self.assertEquals(job.enqueued_at, enqueued_at_date)
self.assertIsNotNone(job.exc_info) # should contain exc_info self.assertIsNotNone(job.exc_info) # should contain exc_info
def test_cancelled_jobs_arent_executed(self): def test_cancelled_jobs_arent_executed(self): # noqa
"""Cancelling jobs.""" """Cancelling jobs."""
SENTINEL_FILE = '/tmp/rq-tests.txt' SENTINEL_FILE = '/tmp/rq-tests.txt'
@ -132,7 +134,7 @@ class TestWorker(RQTestCase):
assert self.testconn.exists(job_without_rv.key) == False assert self.testconn.exists(job_without_rv.key) == False
def test_timeouts(self): def test_timeouts(self): # noqa
"""Worker kills jobs after timeout.""" """Worker kills jobs after timeout."""
sentinel_file = '/tmp/.rq_sentinel' sentinel_file = '/tmp/.rq_sentinel'

Loading…
Cancel
Save