Skip to content

Commit

Permalink
Mypy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gbdlin committed Aug 8, 2024
1 parent 823f026 commit 257b3c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ migrations/create:
alembic revision

dc/build:
docker-compose -f docker-compose.local.yml build
docker compose -f docker-compose.local.yml build

dc/%:
docker-compose -f docker-compose.local.yml run -w /app plugin_store make $*
docker compose -f docker-compose.local.yml run -w /app plugin_store make $*

deps/lock:
poetry lock --no-update
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def seed_db_sessionmaker(seed_db_engine: tuple["AsyncEngine", "sessionmaker"]) -


@pytest_asyncio.fixture()
async def seed_db_session(seed_db_engine: tuple["AsyncEngine", "sessionmaker"]) -> "AsyncSession":
async def seed_db_session(seed_db_engine: tuple["AsyncEngine", "sessionmaker"]) -> "AsyncIterator[AsyncSession]":
async with prepare_transactioned_db_session(*seed_db_engine) as session:
yield session

Expand Down
9 changes: 8 additions & 1 deletion tests/db_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import datetime, timedelta, UTC
from hashlib import sha256
from os import getenv
from typing import TYPE_CHECKING

from sqlalchemy import event
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine
Expand All @@ -11,6 +12,9 @@

from database.models import Artifact, Base, Tag, Version

if TYPE_CHECKING:
from typing import AsyncIterator


class FakePluginGenerator:
def __init__(
Expand Down Expand Up @@ -168,7 +172,10 @@ async def prepare_test_db(


@asynccontextmanager
async def prepare_transactioned_db_session(engine: "AsyncEngine", db_sessionmaker: "sessionmaker") -> "AsyncSession":
async def prepare_transactioned_db_session(
engine: "AsyncEngine",
db_sessionmaker: "sessionmaker",
) -> "AsyncIterator[AsyncSession]":
connection = await engine.connect()
outer_transaction = await connection.begin()
async_session = db_sessionmaker(bind=connection)
Expand Down

0 comments on commit 257b3c3

Please sign in to comment.