mirror of
https://github.com/home-assistant/core.git
synced 2025-08-23 22:41:39 +02:00
use recursion_limit
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
from datetime import timedelta
|
||||
import http
|
||||
import sys
|
||||
import time
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
@@ -148,12 +149,12 @@ async def test_websocket_not_available(
|
||||
)
|
||||
|
||||
# Initial call count and range for reconnection attempts
|
||||
|
||||
mock_automower_client.reset_mock()
|
||||
recursion_limit = sys.getrecursionlimit()
|
||||
# Perform reconnection attempts
|
||||
for count in range(1, 945):
|
||||
for count in range(recursion_limit):
|
||||
await hass.async_block_till_done()
|
||||
assert mock_automower_client.auth.websocket_connect.call_count == count
|
||||
assert mock_automower_client.auth.websocket_connect.call_count == count + 1
|
||||
assert mock_config_entry.state is ConfigEntryState.LOADED
|
||||
|
||||
# Simulate a successful connection
|
||||
@@ -170,7 +171,10 @@ async def test_websocket_not_available(
|
||||
freezer.tick(timedelta(seconds=0))
|
||||
async_fire_time_changed(hass)
|
||||
await hass.async_block_till_done()
|
||||
assert mock_automower_client.auth.websocket_connect.call_count == 946
|
||||
assert (
|
||||
mock_automower_client.auth.websocket_connect.call_count
|
||||
== recursion_limit + 2
|
||||
)
|
||||
|
||||
|
||||
async def test_device_info(
|
||||
|
Reference in New Issue
Block a user