Fix ruff lint and formatting issues

This commit is contained in:
CHANGE
2026-03-12 13:03:39 -04:00
parent 633ea43dc1
commit 3afc9468c0
4 changed files with 11 additions and 8 deletions

View File

@@ -17,9 +17,6 @@ from sqlalchemy.ext.asyncio import (
create_async_engine,
)
from sqlalchemy.orm import sessionmaker
from testcontainers.postgres import PostgresContainer
from xdist import is_xdist_controller
from storage.api_key import ApiKey # noqa: F401
from storage.base import Base
from storage.billing_session import BillingSession
@@ -38,7 +35,8 @@ from storage.stored_conversation_metadata_saas import (
from storage.stored_offline_token import StoredOfflineToken
from storage.stripe_customer import StripeCustomer
from storage.user import User
from testcontainers.postgres import PostgresContainer
from xdist import is_xdist_controller
# ---------------------------------------------------------------------------
# PostgreSQL container lifecycle — managed by the xdist controller
@@ -144,6 +142,7 @@ def pytest_sessionfinish(session, exitstatus):
# Fixtures
# ---------------------------------------------------------------------------
@pytest.fixture
def create_keycloak_user_info():
"""Fixture that returns a factory function to create KeycloakUserInfo models.
@@ -174,6 +173,7 @@ def _pg_template_db(request):
# Function-scoped: one cloned database per test
# ---------------------------------------------------------------------------
@pytest.fixture(scope='function')
def _test_db(_pg_template_db):
"""Clone the template database for a single test."""
@@ -196,7 +196,7 @@ def _test_db(_pg_template_db):
with default_engine.connect() as conn:
conn.execute(
text(
f"SELECT pg_terminate_backend(pid) FROM pg_stat_activity "
f'SELECT pg_terminate_backend(pid) FROM pg_stat_activity '
f"WHERE datname = '{db_name}' AND pid <> pg_backend_pid()"
)
)

View File

@@ -40,7 +40,9 @@ async def async_session(async_session_maker) -> AsyncGenerator[AsyncSession, Non
@pytest.fixture
async def async_session_with_users(async_session_maker) -> AsyncGenerator[AsyncSession, None]:
async def async_session_with_users(
async_session_maker,
) -> AsyncGenerator[AsyncSession, None]:
"""Create an async session with pre-populated Org and User rows for testing."""
async with async_session_maker() as db_session:

View File

@@ -90,7 +90,9 @@ class TestConversationCallback:
org = Org(id=UUID('5594c7b6-f959-4b81-92e9-b09c206f5081'), name='test-org')
session.add(org)
session.flush()
user = User(id=UUID('5594c7b6-f959-4b81-92e9-b09c206f5081'), current_org_id=org.id)
user = User(
id=UUID('5594c7b6-f959-4b81-92e9-b09c206f5081'), current_org_id=org.id
)
session.add(user)
session.flush()

View File

@@ -4,7 +4,6 @@ Test that the models are correctly defined.
from uuid import uuid4
import pytest
from storage.org import Org
from storage.org_member import OrgMember
from storage.role import Role