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

Function test_startup_shutdown

tests/test_worker.py:447–461  ·  view source on GitHub ↗
(arq_redis: ArqRedis, worker)

Source from the content-addressed store, hash-verified

445
446
447async def test_startup_shutdown(arq_redis: ArqRedis, worker):
448 calls = []
449
450 async def startup(ctx):
451 calls.append('startup')
452
453 async def shutdown(ctx):
454 calls.append('shutdown')
455
456 await arq_redis.enqueue_job('foobar', _job_id='testing')
457 worker: Worker = worker(functions=[foobar], on_startup=startup, on_shutdown=shutdown)
458 await worker.main()
459 await worker.close()
460
461 assert calls == ['startup', 'shutdown']
462
463
464class CustomError(RuntimeError):

Callers

nothing calls this directly

Calls 4

workerFunction · 0.85
enqueue_jobMethod · 0.80
mainMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…