Skip to content

Commit 19756ba

Browse files
author
Andrei Neagu
committed
using annotations
1 parent edea03d commit 19756ba

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/service-library/tests/fastapi/long_running_tasks/test_long_running_tasks_context_manager.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import asyncio
55
from collections.abc import AsyncIterable
6-
from typing import Final
6+
from typing import Annotated, Final
77

88
import pytest
99
from asgi_lifespan import LifespanManager
@@ -56,18 +56,18 @@ def user_routes() -> APIRouter:
5656

5757
@router.get("/api/success", status_code=status.HTTP_200_OK)
5858
async def create_task_user_defined_route(
59-
long_running_manager: FastAPILongRunningManager = Depends(
60-
get_long_running_manager
61-
),
59+
long_running_manager: Annotated[
60+
FastAPILongRunningManager, Depends(get_long_running_manager)
61+
],
6262
) -> TaskId:
6363
task_id = start_task(long_running_manager.tasks_manager, task=a_test_task)
6464
return task_id
6565

6666
@router.get("/api/failing", status_code=status.HTTP_200_OK)
6767
async def create_task_which_fails(
68-
long_running_manager: FastAPILongRunningManager = Depends(
69-
get_long_running_manager
70-
),
68+
long_running_manager: Annotated[
69+
FastAPILongRunningManager, Depends(get_long_running_manager)
70+
],
7171
) -> TaskId:
7272
task_id = start_task(
7373
long_running_manager.tasks_manager, task=a_failing_test_task

0 commit comments

Comments
 (0)