(arq_redis: ArqRedis, worker, caplog)
| 321 | |
| 322 | @pytest.mark.skipif(sys.version_info >= (3, 8), reason='3.8 deals with CancelledError differently') |
| 323 | async 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 | |
| 340 | async def test_retry_job_error(arq_redis: ArqRedis, worker, caplog): |
nothing calls this directly
no test coverage detected
searching dependent graphs…