mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 05:02:49 +00:00
* Update the ruff rules and format the code * Update the per-file-ignores * Update the ci * Update rules * Fix codes * Fix pagination * Update rules
16 lines
513 B
Python
16 lines
513 B
Python
from collections.abc import AsyncGenerator
|
|
|
|
from sqlalchemy.ext.asyncio.session import AsyncSession
|
|
|
|
from backend.database.db import create_async_engine_and_session, create_database_url
|
|
|
|
TEST_SQLALCHEMY_DATABASE_URL = create_database_url(unittest=True)
|
|
|
|
_, async_test_db_session = create_async_engine_and_session(TEST_SQLALCHEMY_DATABASE_URL)
|
|
|
|
|
|
async def override_get_db() -> AsyncGenerator[AsyncSession, None]:
|
|
"""session 生成器"""
|
|
async with async_test_db_session() as session:
|
|
yield session
|