Skip to content

Commit 7ea5b6c

Browse files
committed
Adjusts heartbeat assertions and modifies lifespan factory call in tests
1 parent c7191b2 commit 7ea5b6c

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

packages/stompman/test_stompman/test_connection_lifespan.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,9 @@ async def mock_sleep(delay: float) -> None:
147147

148148
async with EnrichedClient(connection_class=connection_class):
149149
await real_sleep(0)
150-
await real_sleep(0)
151-
await real_sleep(0)
152150

153-
assert sleep_calls == [0, 0, 1, 3, 1, 3]
154-
assert write_heartbeat_mock.mock_calls == [mock.call(), mock.call(), mock.call()]
151+
assert sleep_calls == [0, 0, 1, 3, 1, 3, 1, 3]
152+
assert write_heartbeat_mock.mock_calls == [mock.call(), mock.call(), mock.call(), mock.call()]
155153

156154

157155
def test_make_receipt_id(monkeypatch: pytest.MonkeyPatch) -> None:

packages/stompman/test_stompman/test_connection_manager.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ async def test_get_active_connection_state_ok_concurrent() -> None:
202202
assert first_state is second_state is third_state is fourth_state
203203

204204
enter.assert_called_once_with()
205-
lifespan_factory.assert_called_once_with(connection=BaseMockConnection(), connection_parameters=manager.servers[0])
205+
lifespan_factory.assert_called_once_with(
206+
connection=BaseMockConnection(), connection_parameters=manager.servers[0], set_heartbeat_interval=mock.ANY
207+
)
206208

207209

208210
async def test_connection_manager_context_connection_lost() -> None:

packages/stompman/test_stompman/test_subscription.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,11 @@ async def close_connection_soon(client: stompman.Client) -> None:
325325
assert isinstance(inner_group, ExceptionGroup)
326326
assert len(inner_group.exceptions) == 1
327327

328-
assert isinstance(inner_group.exceptions[0], FailedAllConnectAttemptsError)
328+
inner_inner_group = inner_group.exceptions[0]
329+
assert isinstance(inner_inner_group, ExceptionGroup)
330+
assert len(inner_inner_group.exceptions) == 1
331+
332+
assert isinstance(inner_inner_group.exceptions[0], FailedAllConnectAttemptsError)
329333

330334

331335
def test_make_subscription_id() -> None:

0 commit comments

Comments
 (0)