Skip to content

Instantly share code, notes, and snippets.

View verhovensky's full-sized avatar
💭
"To a real warrior, power perceived may be power achieved."

BH verhovensky

💭
"To a real warrior, power perceived may be power achieved."
View GitHub Profile
@verhovensky
verhovensky / async_db_fixtures.py
Created July 15, 2025 07:59 — forked from SamWarden/async_db_fixtures.py
This is an example of fixtures for tests that depend on a Postgres database
import uuid
from collections.abc import AsyncGenerator, Generator
from typing import cast
import alembic.command
import pytest
from alembic.config import Config as AlembicConfig
from sqlalchemy import URL, Connection, text
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, async_sessionmaker, create_async_engine
from testcontainers.postgres import PostgresContainer