Skip to content

Commit 87216b6

Browse files
committed
update modern-di to fix error with caching dependencies
1 parent 4312c82 commit 87216b6

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

tests/conftest.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
import logging
22
import typing
33

4+
import modern_di_litestar
45
import pytest
56
from httpx import ASGITransport, AsyncClient
67
from sqlalchemy.ext.asyncio import AsyncSession
78

89
from app import ioc
9-
from app.application import AppBuilder
10+
from app.application import application
1011

1112

1213
logger = logging.getLogger(__name__)
1314

1415

1516
@pytest.fixture
16-
def app_builder() -> AppBuilder:
17-
return AppBuilder()
18-
19-
20-
@pytest.fixture
21-
async def client(app_builder: AppBuilder) -> typing.AsyncIterator[AsyncClient]:
17+
async def client() -> typing.AsyncIterator[AsyncClient]:
2218
async with AsyncClient(
23-
transport=ASGITransport(app=app_builder.app), # type: ignore[arg-type]
19+
transport=ASGITransport(app=application), # type: ignore[arg-type]
2420
base_url="http://test",
2521
) as client:
2622
yield client
2723

2824

2925
@pytest.fixture(autouse=True)
30-
async def db_session(app_builder: AppBuilder) -> typing.AsyncIterator[AsyncSession]:
31-
async with app_builder.di_container as di_container:
26+
async def db_session() -> typing.AsyncIterator[AsyncSession]:
27+
async with modern_di_litestar.fetch_di_container(application) as di_container:
3228
engine = await ioc.Dependencies.database_engine.async_resolve(di_container)
3329
connection = await engine.connect()
3430
transaction = await connection.begin()

uv.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)