MCPcopy Create free account
hub / github.com/python-arq/arq / test_exc_extra

Function test_exc_extra

tests/test_worker.py:473–483  ·  view source on GitHub ↗
(arq_redis: ArqRedis, worker, caplog)

Source from the content-addressed store, hash-verified

471
472
473async def test_exc_extra(arq_redis: ArqRedis, worker, caplog):
474 caplog.set_level(logging.INFO)
475 await arq_redis.enqueue_job('error_function', _job_id='testing')
476 worker: Worker = worker(functions=[error_function])
477 await worker.main()
478 assert worker.jobs_failed == 1
479
480 log = re.sub(r'(\d+).\d\ds', r'\1.XXs', '\n'.join(r.message for r in caplog.records))
481 assert '0.XXs ! testing:error_function failed, CustomError: this is the error' in log
482 error = next(r for r in caplog.records if r.levelno == logging.ERROR)
483 assert error.extra == {'x': 'y'}
484
485
486async def test_unpickleable(arq_redis: ArqRedis, worker, caplog):

Callers

nothing calls this directly

Calls 3

workerFunction · 0.85
enqueue_jobMethod · 0.80
mainMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…