from lyra_worker.db import wait_for_db def test_wait_for_db_returns_usable_connection_when_schema_ready(conn): # `conn` fixture guarantees the DB is up and the schema is migrated. result = wait_for_db(timeout=5) try: with result.cursor() as cur: cur.execute('SELECT 1 FROM "Job" LIMIT 0') finally: result.close()