Tests are failing with aiohttp 3.10.1
Closed this issue · 1 comments
mweinelt commented
Describe the bug
After upgrading aiohttp to 3.10.1 the tests for blinkpy 0.23.0 are failing:
FAILED tests/test_api.py::TestAPI::test_request_camera_usage - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_cameras - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_command_status - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_get_config - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_local_storage_clip - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_logout - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_motion_detection_disable - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_motion_detection_enable - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_network_status - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_networks - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_new_image - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_new_video - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_notification_flags - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_set_notification_flag - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_update_config - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_user - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_verify - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_request_video_count - RuntimeError: no running event loop
FAILED tests/test_api.py::TestAPI::test_wait_for_command - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_auth_startup - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_bad_response_code - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_barebones_init - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_check_key_required - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_empty_init - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_full_init - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_good_response_code - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_header - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_header_no_token - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_logout - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_query - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_query_retry - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_query_retry_failed - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_refresh_token - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_refresh_token_failed - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_response_bad_json - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_response_not_json - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_send_auth_key - RuntimeError: no running event loop
FAILED tests/test_auth.py::TestAuth::test_send_auth_key_fail - RuntimeError: no running event loop
FAILED tests/test_blinkpy.py::TestBlinkSetup::test_initialization - RuntimeError: no running event loop
To Reproduce
Steps to reproduce the behavior:
- Update aiohttp to 3.10.1
- Run the tests
Expected behavior
A clear and concise description of what you expected to happen.
Home Assistant version (if applicable): 2024.8.0
blinkpy
version (not needed if filling out Home Assistant version): 0.23.0
Log Output/Additional Information
The tests all fail in a similar way when calling ClientSession()
:
______________________ TestBlinkSetup.test_initialization ______________________
self = <tests.test_blinkpy.TestBlinkSetup testMethod=test_initialization>
def test_initialization(self):
"""Verify we can initialize blink."""
> blink = Blink()
tests/test_blinkpy.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
blinkpy/blinkpy.py:63: in __init__
self.auth = Auth(session=session)
blinkpy/auth.py:58: in __init__
self.session = session if session else ClientSession()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <aiohttp.client.ClientSession object at 0x7ffff4b68950>, base_url = None
def __init__(
self,
base_url: Optional[StrOrURL] = None,
*,
connector: Optional[BaseConnector] = None,
loop: Optional[asyncio.AbstractEventLoop] = None,
cookies: Optional[LooseCookies] = None,
headers: Optional[LooseHeaders] = None,
skip_auto_headers: Optional[Iterable[str]] = None,
auth: Optional[BasicAuth] = None,
json_serialize: JSONEncoder = json.dumps,
request_class: Type[ClientRequest] = ClientRequest,
response_class: Type[ClientResponse] = ClientResponse,
ws_response_class: Type[ClientWebSocketResponse] = ClientWebSocketResponse,
version: HttpVersion = http.HttpVersion11,
cookie_jar: Optional[AbstractCookieJar] = None,
connector_owner: bool = True,
raise_for_status: Union[
bool, Callable[[ClientResponse], Awaitable[None]]
] = False,
read_timeout: Union[float, _SENTINEL] = sentinel,
conn_timeout: Optional[float] = None,
timeout: Union[object, ClientTimeout] = sentinel,
auto_decompress: bool = True,
trust_env: bool = False,
requote_redirect_url: bool = True,
trace_configs: Optional[List[TraceConfig]] = None,
read_bufsize: int = 2**16,
max_line_size: int = 8190,
max_field_size: int = 8190,
fallback_charset_resolver: _CharsetResolver = lambda r, b: "utf-8",
) -> None:
# We initialise _connector to None immediately, as it's referenced in __del__()
# and could cause issues if an exception occurs during initialisation.
self._connector: Optional[BaseConnector] = None
if loop is None:
if connector is not None:
loop = connector._loop
> loop = loop or asyncio.get_running_loop()
E RuntimeError: no running event loop
/nix/store/ahq3bc6pmnzmwgic0gap5ma75jajr7j8-python3.12-aiohttp-3.10.1/lib/python3.12/site-packages/aiohttp/client.py:296: RuntimeError