mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Make timeout adjustable (#494)
This commit is contained in:
@@ -166,7 +166,7 @@ async def _update_and_close(d):
|
||||
|
||||
|
||||
async def _discover_update_and_close(ip):
|
||||
d = await Discover.discover_single(ip)
|
||||
d = await Discover.discover_single(ip, timeout=10)
|
||||
return await _update_and_close(d)
|
||||
|
||||
|
||||
|
@@ -194,3 +194,9 @@ async def test_modules_preserved(dev: SmartDevice):
|
||||
dev._last_update["some_module_not_being_updated"] = "should_be_kept"
|
||||
await dev.update()
|
||||
assert dev._last_update["some_module_not_being_updated"] == "should_be_kept"
|
||||
|
||||
|
||||
async def test_create_smart_device_with_timeout():
|
||||
"""Make sure timeout is passed to the protocol."""
|
||||
dev = SmartDevice(host="127.0.0.1", timeout=100)
|
||||
assert dev.protocol.timeout == 100
|
||||
|
Reference in New Issue
Block a user