From d1da6ea04dce672e53e147143444c1d142426052 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 22 Sep 2022 17:39:38 -1000 Subject: [PATCH] Fix flapping bluetooth scanner test (#78961) --- tests/components/bluetooth/test_scanner.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/components/bluetooth/test_scanner.py b/tests/components/bluetooth/test_scanner.py index e11d0c57837..91e8ab50971 100644 --- a/tests/components/bluetooth/test_scanner.py +++ b/tests/components/bluetooth/test_scanner.py @@ -1,4 +1,5 @@ """Tests for the Bluetooth integration scanners.""" +from datetime import timedelta import time from unittest.mock import MagicMock, patch @@ -241,9 +242,11 @@ async def test_recovery_from_dbus_restart(hass, one_adapter): # We hit the timer, so we restart the scanner with patch( "homeassistant.components.bluetooth.scanner.MONOTONIC_TIME", - return_value=start_time_monotonic + SCANNER_WATCHDOG_TIMEOUT, + return_value=start_time_monotonic + SCANNER_WATCHDOG_TIMEOUT + 20, ): - async_fire_time_changed(hass, dt_util.utcnow() + SCANNER_WATCHDOG_INTERVAL) + async_fire_time_changed( + hass, dt_util.utcnow() + SCANNER_WATCHDOG_INTERVAL + timedelta(seconds=20) + ) await hass.async_block_till_done() assert called_start == 2