A module-level asyncio.Lock binds to the loop it was first awaited on. Under pytest-anyio (and xdist) each test spins up a new loop; any later test that hit /health or /config would wait on a lock owned by a dead loop and the whole worker would hang. Create the lock on first use and drop it in the test-reset helpers so a fresh loop always gets a fresh lock.