Merge pull request #238 from selwin/logging-import-errors

register_sentry fixes
main
Selwin Ong 12 years ago
commit f8c9155d08

@ -7,7 +7,7 @@ def register_sentry(client, worker):
exc_info=exc_info, exc_info=exc_info,
extra={ extra={
'job_id': job.id, 'job_id': job.id,
'func': job.func, 'func': job.func_name,
'args': job.args, 'args': job.args,
'kwargs': job.kwargs, 'kwargs': job.kwargs,
'description': job.description, 'description': job.description,

@ -0,0 +1,29 @@
from tests import RQTestCase
from rq import Queue, Worker, get_failed_queue
from rq.contrib.sentry import register_sentry
class FakeSentry(object):
def captureException(self, *args, **kwds):
pass # we cannot check this, because worker forks
class TestSentry(RQTestCase):
def test_work_fails(self):
"""Non importable jobs should be put on the failed queue event with sentry"""
q = Queue()
failed_q = get_failed_queue()
# Action
q.enqueue('_non.importable.job')
self.assertEquals(q.count, 1)
w = Worker([q])
register_sentry(FakeSentry(), w)
w.work(burst=True)
# Postconditions
self.assertEquals(failed_q.count, 1)
self.assertEquals(q.count, 0)
Loading…
Cancel
Save