tmux-amq/tests/test_shutdown.py
tegwick 4d915a2617
Some checks failed
tamq-ci / test (push) Failing after 36s
Bootstrap tamq local tmux agent message queue
Assistant: codex
Assistant-Model: gpt-5.6-sol
Assistant-Session: 01a02f34-ead4-7a60-85cd-d7f08e22fa0e
2026-08-24 01:18:40 +02:00

25 lines
754 B
Python

import asyncio
from tamq.service import Service
from tamq.store import Store
def test_service_shutdown_removes_socket(tmp_path, monkeypatch):
monkeypatch.setenv("TAMQ_PIDFILE", str(tmp_path / "tamq.pid"))
async def run():
socket = tmp_path / "tamq.sock"
service = Service(socket, Store(tmp_path / "queue.sqlite3"))
task = asyncio.create_task(service.run())
for _ in range(20):
if socket.exists():
break
await asyncio.sleep(0.01)
assert socket.exists()
service.server.close()
await service.server.wait_closed()
task.cancel()
try:
await task
except asyncio.CancelledError:
pass
asyncio.run(run())