chore: add lint/test workflows

This commit is contained in:
2026-01-25 16:21:10 +01:00
parent 762ed35341
commit 8a46a12d15
6 changed files with 132 additions and 15 deletions

View File

@@ -5,13 +5,13 @@ import os
import pytest
from pydantic import BaseModel
from sqlalchemy import ForeignKey, String
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
from fastapi_toolsets.crud import CrudFactory
# PostgreSQL connection URL from environment or default for local development
DATABASE_URL = os.getenv(
DATABASE_URL = os.getenv("DATABASE_URL") or os.getenv(
"TEST_DATABASE_URL",
"postgresql+asyncpg://postgres:postgres@localhost:5432/fastapi_toolsets_test",
)
@@ -149,7 +149,7 @@ async def engine():
@pytest.fixture(scope="function")
async def db_session(engine) -> AsyncSession:
async def db_session(engine):
"""Create a test database session with tables.
Creates all tables before the test and drops them after.