Skip to content

Commit 6b822df

Browse files
committed
test: wait for the ready callback in test_start_connect_failure
1 parent 5584566 commit 6b822df

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tests/devices/test_device_manager.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,15 @@ async def test_start_connect_failure(
291291
fake_device.mqtt_channel.clear_error()
292292
fake_device.local_channel.clear_error()
293293

294-
# Wait for the device to attempt to connect again and succeed
294+
# The ready callback runs once the device has finished starting, which is after
295+
# the channel reports that it is connected.
295296
attempts = 0
296-
while not devices[0].is_connected:
297+
while not ready_devices:
297298
await asyncio.sleep(0.01)
298299
attempts += 1
299-
assert attempts < 10, "Device did not connect after multiple attempts"
300+
assert attempts < 100, "Device did not become ready after multiple attempts"
300301

301302
assert devices[0].is_connected
302-
assert ready_devices
303303
assert len(ready_devices) == 1
304304

305305
await device_manager.close()

0 commit comments

Comments
 (0)