fix: remove alembic from CI tests, drop_all before create_all in conftest
This commit is contained in:
@@ -42,12 +42,6 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: pip install -r backend/requirements.txt -r backend/requirements-test.txt
|
||||
|
||||
- name: Run migrations
|
||||
working-directory: backend
|
||||
env:
|
||||
DATABASE_URL: postgresql+asyncpg://test:test@postgres:5432/gartenmanager_test
|
||||
run: alembic upgrade head
|
||||
|
||||
- name: Run tests
|
||||
working-directory: backend
|
||||
env:
|
||||
|
||||
@@ -33,6 +33,8 @@ def event_loop():
|
||||
@pytest_asyncio.fixture(scope="session")
|
||||
async def setup_database():
|
||||
async with _engine.begin() as conn:
|
||||
# drop_all first to clean up from any previous interrupted run
|
||||
await conn.run_sync(Base.metadata.drop_all)
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
yield
|
||||
async with _engine.begin() as conn:
|
||||
@@ -98,7 +100,6 @@ async def test_user(db: AsyncSession, test_tenant: Tenant):
|
||||
await db.flush()
|
||||
db.add(UserTenant(user_id=user.id, tenant_id=test_tenant.id, role=TenantRole.READ_WRITE))
|
||||
await db.commit()
|
||||
# Attach plaintext password for use in auth fixtures
|
||||
user._plain_password = password # type: ignore[attr-defined]
|
||||
yield user
|
||||
|
||||
|
||||
Reference in New Issue
Block a user