Skip to content

Commit

Permalink
Use Worker instead of SimpleWorker in test
Browse files Browse the repository at this point in the history
  • Loading branch information
selwin committed Oct 29, 2024
1 parent 50b83ce commit 7b1138b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from rq import Queue, Worker
from rq.job import Job, JobStatus, UNEVALUATED
from rq.worker import SimpleWorker
from rq.worker import SimpleWorker, Worker


class QueueCallbackTestCase(RQTestCase):
Expand Down Expand Up @@ -81,15 +81,14 @@ def test_erroneous_success_callback(self):
def test_failure_callback(self):
"""Test failure callback is executed only when job a fails"""
queue = Queue(connection=self.testconn)
worker = SimpleWorker([queue], connection=self.testconn)
worker = Worker([queue], connection=self.testconn)

job = queue.enqueue(div_by_zero, on_failure=save_exception)

# Callback is executed when job is successfully executed
worker.work(burst=True)
self.assertEqual(job.get_status(), JobStatus.FAILED)
job.refresh()
print(job.exc_info)
self.assertIn('div_by_zero',
self.testconn.get('failure_callback:%s' % job.id).decode())

Expand Down

0 comments on commit 7b1138b

Please sign in to comment.