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

Function test_cancel_error

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

Source from the content-addressed store, hash-verified

321
322@pytest.mark.skipif(sys.version_info >= (3, 8), reason='3.8 deals with CancelledError differently')
323async def test_cancel_error(arq_redis: ArqRedis, worker, caplog):
324 async def retry(ctx):
325 if ctx['job_try'] == 1:
326 raise asyncio.CancelledError()
327
328 caplog.set_level(logging.INFO)
329 await arq_redis.enqueue_job('retry', _job_id='testing')
330 worker: Worker = worker(functions=[func(retry, name='retry')])
331 await worker.main()
332 assert worker.jobs_complete == 1
333 assert worker.jobs_failed == 0
334 assert worker.jobs_retried == 1
335
336 log = re.sub(r'\d+.\d\ds', 'X.XXs', '\n'.join(r.message for r in caplog.records))
337 assert 'X.XXs ↻ testing:retry cancelled, will be run again' in log
338
339
340async def test_retry_job_error(arq_redis: ArqRedis, worker, caplog):

Callers

nothing calls this directly

Calls 4

funcFunction · 0.90
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…