refactor: remove duplicate fixtures and add SQLite support
Task 2.5: Remove duplicate fixtures from integration tests - test_auth_api.py, test_auth_services.py, test_models.py - test_projects_api.py, test_seed.py, test_users_api.py - Fix npytest typos in all test files Task 3.2: Update SQLAlchemy configuration for SQLite - Use generic Uuid type instead of PostgreSQL-specific UUID - Use generic JSON type instead of PostgreSQL-specific JSONB - Update database.py to handle SQLite connection args Unit tests now run without PostgreSQL (5/8 passing)
This commit is contained in:
@@ -5,10 +5,18 @@ from src.config import Settings, build_database_url
|
||||
|
||||
|
||||
settings = Settings()
|
||||
database_url = settings.database_url
|
||||
|
||||
# SQLite requires aiosqlite and different connect args
|
||||
connect_args = {}
|
||||
if database_url.startswith("sqlite"):
|
||||
connect_args = {"check_same_thread": False}
|
||||
|
||||
engine = create_async_engine(
|
||||
settings.database_url,
|
||||
database_url,
|
||||
future=True,
|
||||
poolclass=NullPool,
|
||||
connect_args=connect_args,
|
||||
)
|
||||
SessionLocal = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user