fix(tests): drop_all before create_all to clear stale PostgreSQL enums
If a previous test run was interrupted before teardown, PostgreSQL enum types persist with stale values, causing create_all to fail. Adding drop_all first ensures a clean slate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ async def engine():
|
||||
"""Create the test engine and schema once for the entire session."""
|
||||
eng = create_async_engine(TEST_DATABASE_URL, echo=False)
|
||||
async with eng.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.drop_all)
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
yield eng
|
||||
async with eng.begin() as conn:
|
||||
|
||||
Reference in New Issue
Block a user