From b52c2522183f3971af5b5363df54a61afc89ce5e Mon Sep 17 00:00:00 2001 From: Securityhigh Date: Sun, 24 Aug 2025 03:08:45 +0700 Subject: [PATCH] Faststream 0.6.0 support --- pyproject.toml | 2 +- taskiq_faststream/utils.py | 2 +- tests/testcase.py | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7f00fb2..31b064b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ classifiers = [ dependencies = [ "taskiq>=0.11.0,<0.12.0", - "faststream>=0.3.14,<0.6.0", + "faststream>=0.6.0rc0", ] [project.optional-dependencies] diff --git a/taskiq_faststream/utils.py b/taskiq_faststream/utils.py index ba1cb76..71504b2 100644 --- a/taskiq_faststream/utils.py +++ b/taskiq_faststream/utils.py @@ -2,7 +2,7 @@ from fast_depends.utils import is_async_gen_callable, is_gen_callable from faststream.types import SendableMessage -from faststream.utils.functions import to_async +from faststream._internal.utils.functions import to_async async def resolve_msg( diff --git a/tests/testcase.py b/tests/testcase.py index 738a9fa..03287b9 100644 --- a/tests/testcase.py +++ b/tests/testcase.py @@ -1,12 +1,12 @@ import asyncio import typing +import anyio from datetime import datetime, timedelta, timezone -from typing import Any +from typing import Any, Optional, ContextManager, Callable from unittest.mock import MagicMock import pytest from faststream.types import SendableMessage -from faststream.utils.functions import timeout_scope from freezegun import freeze_time from taskiq import AsyncBroker from taskiq.cli.scheduler.args import SchedulerArgs @@ -17,6 +17,16 @@ from tests import messages +def timeout_scope( + timeout: Optional[float] = 30, + raise_timeout: bool = False, +) -> ContextManager[anyio.CancelScope]: + scope: Callable[[Optional[float]], ContextManager[anyio.CancelScope]] + scope = anyio.fail_after if raise_timeout else anyio.move_on_after + + return scope(timeout) + + @pytest.mark.anyio class SchedulerTestcase: test_class: Any