Skip to content

Commit

Permalink
increase reliability of test
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdavb committed Aug 17, 2024
1 parent f48465a commit 9d659f2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/tests_old/test_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import asyncio
from collections.abc import AsyncGenerator
from datetime import datetime as dt, timedelta as td
from typing import Any, Final
Expand Down Expand Up @@ -242,12 +243,22 @@ async def _setup_via_entry_(
assert await hass.config_entries.async_setup(entry.entry_id)
# await hass.async_block_till_done() # ?clear hass._tasks

await _cast_packets_to_rf(hass, rf) # FIXME: how to wait until last pkt Tx'd?
await _cast_packets_to_rf(hass, rf)

broker: RamsesBroker = list(hass.data[DOMAIN].values())[0]

await broker.async_update()
await hass.async_block_till_done()

try:
assert len(broker._entities) == NUM_ENTS_AFTER # proxy for success of above

except AssertionError:
await asyncio.sleep(0.05) # FIXME: how best to wait until last pkt Tx'd?

await broker.async_update()
await hass.async_block_till_done()

assert len(broker._entities) == NUM_ENTS_AFTER # proxy for success of above

return entry
Expand Down

0 comments on commit 9d659f2

Please sign in to comment.