| 47 | |
| 48 | |
| 49 | async def test_enqueue_job_nested(arq_redis: ArqRedis, worker): |
| 50 | async def foobar(ctx): |
| 51 | return 42 |
| 52 | |
| 53 | async def parent_job(ctx): |
| 54 | inner_job = await ctx['redis'].enqueue_job('foobar') |
| 55 | return inner_job.job_id |
| 56 | |
| 57 | job = await arq_redis.enqueue_job('parent_job') |
| 58 | worker: Worker = worker(functions=[func(parent_job, name='parent_job'), func(foobar, name='foobar')]) |
| 59 | |
| 60 | await worker.main() |
| 61 | result = await job.result(poll_delay=0) |
| 62 | assert result is not None |
| 63 | inner_job = Job(result, arq_redis) |
| 64 | inner_result = await inner_job.result(poll_delay=0) |
| 65 | assert inner_result == 42 |
| 66 | |
| 67 | |
| 68 | async def test_enqueue_job_nested_custom_serializer( |