(arq_redis: ArqRedis, worker, caplog)
| 971 | |
| 972 | |
| 973 | async def test_job_timeout(arq_redis: ArqRedis, worker, caplog): |
| 974 | async def longfunc(ctx): |
| 975 | await asyncio.sleep(0.3) |
| 976 | |
| 977 | caplog.set_level(logging.ERROR) |
| 978 | await arq_redis.enqueue_job('longfunc', _job_id='testing') |
| 979 | worker: Worker = worker(functions=[func(longfunc, name='longfunc')], job_timeout=0.2, poll_delay=0.1) |
| 980 | assert worker.jobs_complete == 0 |
| 981 | assert worker.jobs_failed == 0 |
| 982 | assert worker.jobs_retried == 0 |
| 983 | await worker.main() |
| 984 | assert worker.jobs_complete == 0 |
| 985 | assert worker.jobs_failed == 1 |
| 986 | assert worker.jobs_retried == 0 |
| 987 | log = re.sub(r'\d+.\d\ds', 'X.XXs', '\n'.join(r.message for r in caplog.records)) |
| 988 | assert 'X.XXs ! testing:longfunc failed, TimeoutError:' in log |
| 989 | |
| 990 | |
| 991 | async def test_on_job(arq_redis: ArqRedis, worker): |
nothing calls this directly
no test coverage detected
searching dependent graphs…