Skip to content

Commit 933c19d

Browse files
committed
feat (#77): correct AppWrapper types
1 parent d0a3d1f commit 933c19d

File tree

6 files changed

+32
-5
lines changed

6 files changed

+32
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ test = [
8181

8282
dev = [
8383
"taskiq-faststream[test]",
84-
85-
"mypy>=1.8.0,<1.16.0",
84+
"mypy==1.11.2",
8685
"ruff==0.11.8",
8786
"pre-commit >=3.6.0,<5.0.0",
8887
]

taskiq_faststream/broker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Any
44

55
import anyio
6-
from faststream.app import FastStream
6+
from faststream._internal.application import Application
77
from faststream.types import SendableMessage
88
from taskiq import AsyncBroker
99
from taskiq.acks import AckableMessage
@@ -66,7 +66,7 @@ async def listen(
6666
yield b""
6767
await anyio.sleep(60)
6868

69-
def task(
69+
def task( # type: ignore[override]
7070
self,
7171
message: typing.Union[
7272
None,
@@ -106,7 +106,7 @@ class AppWrapper(BrokerWrapper):
106106
task : Register FastStream scheduled task.
107107
"""
108108

109-
def __init__(self, app: FastStream) -> None:
109+
def __init__(self, app: Application) -> None:
110110
super(BrokerWrapper, self).__init__()
111111
self.formatter = PatchedFormatter()
112112
self.app = app

tests/test_kafka.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ class TestApp(TestBroker):
2323
def build_taskiq_broker(broker: KafkaBroker) -> AsyncBroker:
2424
"""Build AppWrapper."""
2525
return AppWrapper(FastStream(broker))
26+
27+
28+
class TestAsgiApp(TestBroker):
29+
@staticmethod
30+
def build_taskiq_broker(broker: KafkaBroker) -> AsyncBroker:
31+
"""Build AppWrapper."""
32+
return AppWrapper(FastStream(broker).as_asgi())

tests/test_nats.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ class TestApp(TestBroker):
2323
def build_taskiq_broker(broker: NatsBroker) -> AsyncBroker:
2424
"""Build AppWrapper."""
2525
return AppWrapper(FastStream(broker))
26+
27+
28+
class TestAsgiApp(TestBroker):
29+
@staticmethod
30+
def build_taskiq_broker(broker: NatsBroker) -> AsyncBroker:
31+
"""Build AppWrapper."""
32+
return AppWrapper(FastStream(broker).as_asgi())

tests/test_rabbit.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ class TestApp(TestBroker):
2323
def build_taskiq_broker(broker: RabbitBroker) -> AsyncBroker:
2424
"""Build AppWrapper."""
2525
return AppWrapper(FastStream(broker))
26+
27+
28+
class TestAsgiApp(TestBroker):
29+
@staticmethod
30+
def build_taskiq_broker(broker: RabbitBroker) -> AsyncBroker:
31+
"""Build AppWrapper."""
32+
return AppWrapper(FastStream(broker).as_asgi())

tests/test_redis.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@ class TestApp(TestBroker):
2323
def build_taskiq_broker(broker: RedisBroker) -> AsyncBroker:
2424
"""Build AppWrapper."""
2525
return AppWrapper(FastStream(broker))
26+
27+
28+
class TestAsgiApp(TestBroker):
29+
@staticmethod
30+
def build_taskiq_broker(broker: RedisBroker) -> AsyncBroker:
31+
"""Build AppWrapper."""
32+
return AppWrapper(FastStream(broker).as_asgi())

0 commit comments

Comments
 (0)