Fix modbus test assuming repeat listeners always fire at 0 microseconds (#82320)
This commit is contained in:
parent
dd960c4e62
commit
077bd594eb
1 changed files with 4 additions and 1 deletions
|
@ -733,7 +733,10 @@ async def test_delay(hass, mock_pymodbus):
|
||||||
time_stop = time_after_scan + timedelta(seconds=10)
|
time_stop = time_after_scan + timedelta(seconds=10)
|
||||||
now = start_time
|
now = start_time
|
||||||
while now < time_stop:
|
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(
|
with mock.patch(
|
||||||
"homeassistant.helpers.event.dt_util.utcnow",
|
"homeassistant.helpers.event.dt_util.utcnow",
|
||||||
return_value=now,
|
return_value=now,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue