Skip to content

Commit 2be2c32

Browse files
authored
test: fix compatibility
2 parents c90f3dd + 7a73077 commit 2be2c32

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
strategy:
4242
matrix:
43-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
43+
python-version: ["3.8", "3.9", "3.10", "3.11"]
4444
pydantic-version: ["pydantic-v1", "pydantic-v2"]
4545
fail-fast: false
4646

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<a href="https://pepy.tech/project/taskiq-faststream" target="_blank">
1111
<img src="https://static.pepy.tech/personalized-badge/taskiq-faststream?period=month&units=international_system&left_color=grey&right_color=blue" alt="downloads"/>
1212
</a>
13-
<br/>
1413
<a href="https://pypi.org/project/taskiq-faststream" target="_blank">
1514
<img src="https://img.shields.io/pypi/pyversions/taskiq-faststream.svg" alt="Supported Python versions">
1615
</a>
@@ -79,12 +78,18 @@ taskiq_broker.task(
7978
)
8079

8180
# create scheduler object
82-
scheduler=TaskiqScheduler(
81+
scheduler = TaskiqScheduler(
8382
broker=taskiq_broker,
8483
sources=[LabelScheduleSource(taskiq_broker)],
8584
)
8685
```
8786

87+
To run the scheduler, just use the following command
88+
89+
```bash
90+
taskiq scheduler module:scheduler
91+
```
92+
8893
Also, you can wrap your **FastStream** application the same way (allows to use lifespan events and AsyncAPI documentation):
8994

9095
```python
@@ -106,7 +111,7 @@ taskiq_broker = AppWrapper(app)
106111
# Code below omitted 👇
107112
```
108113

109-
Also, instead of using a final `message` argument, you can set a message callback to collect information right before sending:
114+
A little feature: instead of using a final `message` argument, you can set a message callback to collect information right before sending:
110115

111116
```python
112117
async def collect_information_to_send():

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ classifiers = [
2525
"Programming Language :: Python :: 3.9",
2626
"Programming Language :: Python :: 3.10",
2727
"Programming Language :: Python :: 3.11",
28-
"Programming Language :: Python :: 3.12",
2928
"Operating System :: OS Independent",
3029
"Topic :: Software Development :: Libraries :: Python Modules",
3130
"Topic :: Software Development :: Libraries",
@@ -61,14 +60,15 @@ kafka = [
6160

6261
# local dev
6362
test = [
63+
"taskiq-faststream[nats]",
64+
"taskiq-faststream[rabbit]",
65+
"taskiq-faststream[kafka]",
66+
6467
"coverage[toml]>=7.2.0,<8.0.0",
6568
"pytest==7.4.3",
6669
]
6770

6871
dev = [
69-
"taskiq-faststream[nats]",
70-
"taskiq-faststream[rabbit]",
71-
"taskiq-faststream[kafka]",
7272
"taskiq-faststream[test]",
7373

7474
"mypy==1.7.0",

taskiq_faststream/broker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def task( # type: ignore[override]
7575
*,
7676
schedule: typing.List[ScheduledTask],
7777
**kwargs: PublishParameters,
78-
) -> AsyncTaskiqDecoratedTask[[], None]:
78+
) -> "AsyncTaskiqDecoratedTask[[], None]":
7979
"""Register FastStream scheduled task.
8080
8181
Args:

tests/conftest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import asyncio
12
from unittest.mock import MagicMock
23
from uuid import uuid4
34

45
import pytest
5-
from anyio._backends._asyncio import Event
66

77

88
@pytest.fixture(scope="session")
@@ -27,5 +27,6 @@ def mock() -> MagicMock:
2727

2828

2929
@pytest.fixture()
30-
def event() -> Event:
31-
return Event()
30+
@pytest.mark.anyio
31+
async def event() -> asyncio.Event:
32+
return asyncio.Event()

tests/testcase.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from unittest.mock import MagicMock
55

66
import pytest
7-
from anyio import Event
87
from faststream.broker.core.asyncronous import BrokerAsyncUsecase
98
from faststream.utils.functions import timeout_scope
109
from taskiq import AsyncBroker, TaskiqScheduler
@@ -30,7 +29,7 @@ async def test_task(
3029
subject: str,
3130
broker: BrokerAsyncUsecase[Any, Any],
3231
mock: MagicMock,
33-
event: Event,
32+
event: asyncio.Event,
3433
) -> None:
3534
"""Base testcase."""
3635

0 commit comments

Comments
 (0)