diff --git a/pyproject.toml b/pyproject.toml index b9cf622..06169a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "violet-poolController-api" -version = "0.0.25" +version = "0.0.26" authors = [ { name="Basti (Xerolux)", email="git@xerolux.de" }, ] @@ -24,12 +24,12 @@ classifiers = [ "Topic :: Home Automation", ] dependencies = [ - "aiohttp>=3.11.0", + "aiohttp>=3.11.0,<3.14", ] [project.optional-dependencies] test = [ - "aioresponses>=0.7.7", + "aioresponses>=0.7.8", "pytest>=8.3", "pytest-asyncio>=0.24", ] @@ -45,13 +45,13 @@ asyncio_mode = "auto" [tool.ruff] line-length = 100 -target-version = "0.0.25" +target-version = "py312" [tool.ruff.lint] select = ["E", "F", "W", "I", "UP"] ignore = ["E501"] [tool.mypy] -python_version = "0.0.25" +python_version = "3.12" warn_return_any = true warn_unused_configs = true diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..4dd6f6a --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,40 @@ +# violet-poolController-api - API für Violet Pool Controller +# Copyright (C) 2024-2026 Xerolux +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +"""Pytest configuration and fixtures.""" + +from __future__ import annotations + +from inspect import signature + +import aiohttp.client_reqrep + +_original_client_response_init = aiohttp.client_reqrep.ClientResponse.__init__ + + +def _patched_client_response_init( + self: aiohttp.client_reqrep.ClientResponse, + *args: object, + **kwargs: object, +) -> None: + """Patched ClientResponse.__init__ that adds stream_writer if missing.""" + sig = signature(_original_client_response_init) + if "stream_writer" in sig.parameters and "stream_writer" not in kwargs: + kwargs["stream_writer"] = None + _original_client_response_init(self, *args, **kwargs) + + +aiohttp.client_reqrep.ClientResponse.__init__ = _patched_client_response_init