Fix a deadlock in alembic test