From 838fb3ecf1f7b4176e8812a9fb8f876c9748a882 Mon Sep 17 00:00:00 2001 From: David Recordon Date: Sun, 22 Feb 2026 20:23:30 -0800 Subject: [PATCH] Fix SSL deprecation warnings, incorrect test assertion, and missing mypy dev dep - Replace deprecated aiohttp TCPConnector(verify_ssl=False) with ssl=False in director.py and websocket.py to silence DeprecationWarnings - Fix test_sio_connect_with_session to assert ssl_verify=True, matching the production code changed in ee45410 - Add mypy to requirements-dev.txt (was stated as added but missing) Co-Authored-By: Claude Opus 4.6 --- pyControl4/director.py | 2 +- pyControl4/websocket.py | 2 +- requirements-dev.txt | 1 + tests/test_websocket_ssl.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyControl4/director.py b/pyControl4/director.py index fce307d..f980841 100644 --- a/pyControl4/director.py +++ b/pyControl4/director.py @@ -54,7 +54,7 @@ async def _get_session(self) -> AsyncGenerator[aiohttp.ClientSession, None]: yield self.session else: async with aiohttp.ClientSession( - connector=aiohttp.TCPConnector(verify_ssl=False) + connector=aiohttp.TCPConnector(ssl=False) ) as session: yield session diff --git a/pyControl4/websocket.py b/pyControl4/websocket.py index 545297e..5d7b71b 100644 --- a/pyControl4/websocket.py +++ b/pyControl4/websocket.py @@ -72,7 +72,7 @@ async def on_clientId(self, client_id: str) -> None: if not self.connected and not self.subscription_id: _LOGGER.debug("Fetching subscriptionID from Control4") session = self.session or aiohttp.ClientSession( - connector=aiohttp.TCPConnector(verify_ssl=False) + connector=aiohttp.TCPConnector(ssl=False) ) try: async with asyncio.timeout(10): diff --git a/requirements-dev.txt b/requirements-dev.txt index 4913560..60596bb 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -4,4 +4,5 @@ python-socketio-v4 websocket-client pdoc3 pytest-asyncio +mypy types-xmltodict diff --git a/tests/test_websocket_ssl.py b/tests/test_websocket_ssl.py index 2d51317..47ac278 100644 --- a/tests/test_websocket_ssl.py +++ b/tests/test_websocket_ssl.py @@ -50,5 +50,5 @@ async def test_sio_connect_with_session(): connector=mock_connector, connector_owner=False ) mock_init.assert_called_once_with( - ssl_verify=False, http_session=mock_http_session + ssl_verify=True, http_session=mock_http_session )