fix(tests): provenance itest user fixture is get-or-create — the lane DB persists across tests
CI & Build / Python lint (push) Successful in 4s
CI & Build / Plugin hooks (push) Successful in 11s
CI & Build / integration (push) Successful in 21s
CI & Build / TypeScript typecheck (push) Successful in 33s
CI & Build / Python tests (push) Successful in 53s
CI & Build / Build & push image (push) Successful in 19s

Both integration tests built the same username; the second insert died
on users_username_key. 19 passed, 1 error on run 3802.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-16 12:06:19 -04:00
co-authored by Claude Fable 5
parent 1e7f66e72d
commit 7d26a3fc6a
+11
View File
@@ -88,10 +88,21 @@ async def _dispose_engine():
@pytest_asyncio.fixture
async def user_id(_dispose_engine):
# Get-or-create: the lane's database persists across tests, so a second
# test re-creating the same username dies on the unique constraint.
from sqlalchemy import select
from scribe.models import async_session
from scribe.models.user import User
async with async_session() as s:
existing = (
await s.execute(
select(User).where(User.username == "snippet_prov_itest")
)
).scalar_one_or_none()
if existing is not None:
return existing.id
user = User(username="snippet_prov_itest")
s.add(user)
await s.flush()