Skip to content

Commit 6f22f6c

Browse files
committed
test: Fixed broker init.
1 parent af7c92a commit 6f22f6c

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- "3.13"
3535
- "3.14"
3636
faststream-version:
37-
- "0.5.48"
38-
- "0.6.2"
37+
- "<0.6.0"
38+
- ">=0.6.0"
3939
steps:
4040
- uses: actions/checkout@v5
4141
- uses: extractions/setup-just@v3
@@ -44,7 +44,7 @@ jobs:
4444
cache-dependency-glob: "**/pyproject.toml"
4545
- run: uv python install ${{ matrix.python-version }}
4646
- run: just install
47-
- run: uv run --with faststream==${{ matrix.faststream-version }} pytest . --cov=. --cov-report xml
47+
- run: uv run --with "faststream${{ matrix.faststream-version }}" pytest . --cov=. --cov-report xml
4848
- uses: codecov/codecov-action@v5.4.3
4949
env:
5050
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

tests/integrations/faststream/test_faststream_di_pass_message.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from that_depends.integrations.faststream import _FASTSTREAM_VERSION
1010

1111

12-
if Version(_FASTSTREAM_VERSION) >= Version("0.6.0"):
12+
if Version(_FASTSTREAM_VERSION) >= Version("0.6.0"): # pragma: no cover
1313
from faststream.message import StreamMessage
14-
else:
14+
else: # pragma: no cover
1515
from faststream.broker.message import StreamMessage # type: ignore[import-not-found, no-redef]
1616

1717

@@ -25,7 +25,11 @@ async def consume_scope(
2525
return await call_next(msg)
2626

2727

28-
broker = NatsBroker(middlewares=(ContextMiddleware,))
28+
if Version(_FASTSTREAM_VERSION) >= Version("0.6.0"): # pragma: no cover
29+
broker = NatsBroker(middlewares=(ContextMiddleware,))
30+
31+
else: # pragma: no cover
32+
broker = NatsBroker(middlewares=(ContextMiddleware,), validate=False) # type: ignore[call-arg]
2933

3034
TEST_SUBJECT = "test"
3135

that_depends/integrations/faststream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
_FASTSTREAM_MODULE_NAME: Final[str] = "faststream"
1515
_FASTSTREAM_VERSION: Final[str] = version(_FASTSTREAM_MODULE_NAME)
16-
if Version(_FASTSTREAM_VERSION) >= Version("0.6.0"):
16+
if Version(_FASTSTREAM_VERSION) >= Version("0.6.0"): # pragma: no cover
1717
from faststream import BaseMiddleware, ContextRepo
1818

1919
class DIContextMiddleware(BaseMiddleware):
@@ -83,7 +83,7 @@ def __call__(self, msg: Any = None, **kwargs: Any) -> "DIContextMiddleware": #
8383
scope=self._scope,
8484
global_context=self._global_context,
8585
)
86-
else:
86+
else: # pragma: no cover
8787
from faststream import BaseMiddleware
8888

8989
@deprecated("Will be removed with faststream v1")

0 commit comments

Comments
 (0)