Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modern_di_starlette/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""modern-di integration for Starlette."""

import collections.abc
import contextlib
import functools
import typing
Expand Down Expand Up @@ -40,7 +41,7 @@ def _compose_lifespan(original: Lifespan[Starlette]) -> Lifespan[Starlette]:
"""

@contextlib.asynccontextmanager
async def composed(app: Starlette) -> typing.AsyncIterator[typing.Mapping[str, typing.Any] | None]:
async def composed(app: Starlette) -> collections.abc.AsyncGenerator[typing.Mapping[str, typing.Any] | None]:
async with original(app) as state, fetch_di_container(app):
yield state

Expand Down
4 changes: 2 additions & 2 deletions tests/test_lifespan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import collections.abc
import contextlib
import typing

import modern_di
from starlette import status
Expand Down Expand Up @@ -33,7 +33,7 @@ def test_setup_di_composes_with_existing_lifespan() -> None:
events: list[str] = []

@contextlib.asynccontextmanager
async def user_lifespan(app_: Starlette) -> typing.AsyncIterator[dict[str, str]]:
async def user_lifespan(app_: Starlette) -> collections.abc.AsyncGenerator[dict[str, str]]:
assert isinstance(app_, Starlette)
events.append("startup")
yield {"marker": "from-user-lifespan"}
Expand Down
Loading