mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-14 19:38:02 +00:00
Add retries to protocol queries (#65)
* Add retries to query(), defaults to 3 + add tests * Catch also json decoding errors for retries * add missing exceptions file, fix old protocol tests
This commit is contained in:
@@ -3,6 +3,7 @@ import glob
|
||||
import json
|
||||
import os
|
||||
from os.path import basename
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
import pytest # type: ignore # see https://github.com/pytest-dev/pytest/issues/3342
|
||||
|
||||
@@ -151,3 +152,14 @@ def pytest_collection_modifyitems(config, items):
|
||||
return
|
||||
else:
|
||||
print("Running against ip %s" % config.getoption("--ip"))
|
||||
|
||||
|
||||
# allow mocks to be awaited
|
||||
# https://stackoverflow.com/questions/51394411/python-object-magicmock-cant-be-used-in-await-expression/51399767#51399767
|
||||
|
||||
|
||||
async def async_magic():
|
||||
pass
|
||||
|
||||
|
||||
MagicMock.__await__ = lambda x: async_magic().__await__()
|
||||
|
Reference in New Issue
Block a user