Ensure bluetooth auto recovery does not run in tests (#109163)

If time was moved forward too much the scanner would try to auto recover
This commit is contained in:
J. Nick Koston 2024-01-30 18:48:05 -10:00 committed by GitHub
parent 4c6ac74313
commit 9c22226fed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1576,9 +1576,10 @@ def mock_bleak_scanner_start() -> Generator[MagicMock, None, None]:
# out start and this fixture will expire before the stop method is called
# when EVENT_HOMEASSISTANT_STOP is fired.
bluetooth_scanner.OriginalBleakScanner.stop = AsyncMock() # type: ignore[assignment]
with patch(
"habluetooth.scanner.OriginalBleakScanner.start",
) as mock_bleak_scanner_start:
with patch.object(
bluetooth_scanner.OriginalBleakScanner,
"start",
) as mock_bleak_scanner_start, patch.object(bluetooth_scanner, "HaScanner"):
yield mock_bleak_scanner_start