From 077bd594eb4294d3726ed24badf8bf3a638a06ad Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 18 Nov 2022 07:23:42 -0600 Subject: [PATCH] Fix modbus test assuming repeat listeners always fire at 0 microseconds (#82320) --- tests/components/modbus/test_init.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/components/modbus/test_init.py b/tests/components/modbus/test_init.py index 11ddf4bc426..e238ecc6170 100644 --- a/tests/components/modbus/test_init.py +++ b/tests/components/modbus/test_init.py @@ -733,7 +733,10 @@ async def test_delay(hass, mock_pymodbus): time_stop = time_after_scan + timedelta(seconds=10) now = start_time while now < time_stop: - now += timedelta(seconds=1) + # This test assumed listeners are always fired at 0 + # microseconds which is impossible in production so + # we use 999999 microseconds to simulate the real world. + now += timedelta(seconds=1, microseconds=999999) with mock.patch( "homeassistant.helpers.event.dt_util.utcnow", return_value=now,