From 4d3b14e62178f3bca365111b17c1f19120a840c3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:40:02 +0000 Subject: [PATCH 1/2] Initial plan From b70b3e62fff7a166a393ff9f2a5548fcfb13b901 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:46:25 +0000 Subject: [PATCH 2/2] Drop aiounittest dependency, use stdlib unittest.IsolatedAsyncioTestCase Co-authored-by: nielstron <20638630+nielstron@users.noreply.github.com> Agent-Logs-Url: https://github.com/nielstron/pyfronius/sessions/2dc35348-3246-4f4f-b481-cca8556f2b09 --- pyproject.toml | 1 - tests/test_web_v0.py | 8 ++++---- tests/test_web_v1.py | 8 ++++---- tests/util.py | 25 ++++--------------------- uv.lock | 13 ------------- 5 files changed, 12 insertions(+), 43 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ecf359b..a5df91e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,6 @@ pyfronius = { workspace = true } [dependency-groups] dev = [ - "aiounittest>=1.5.0", "coverage>=7.6.1", "pre-commit>=3.5.0", "pyfronius", diff --git a/tests/test_web_v0.py b/tests/test_web_v0.py index c4dea2a..198f2f6 100644 --- a/tests/test_web_v0.py +++ b/tests/test_web_v0.py @@ -32,7 +32,7 @@ class NoFroniusWebTest(AsyncTestCaseSetup): session = None fronius = None - async def setUp(self): + async def asyncSetUp(self): # Pick an unused port to ensure the connection attempt fails deterministically self.port = _get_unused_port() self.url = "http://{}:{}".format(ADDRESS, self.port) @@ -92,7 +92,7 @@ class FroniusWebDetectVersionV0(AsyncTestCaseSetup): session = None fronius = None - async def setUp(self): + async def asyncSetUp(self): # Create an arbitrary subclass of TCP Server as the server to be # started # Here, it is an Simple HTTP file serving server @@ -138,7 +138,7 @@ class FroniusWebTestV0(AsyncTestCaseSetup): session = None fronius = None - async def setUp(self): + async def asyncSetUp(self): # Create an arbitrary subclass of TCP Server as the server to be # started # Here, it is an Simple HTTP file serving server @@ -210,7 +210,7 @@ async def test_fronius_get_no_data(self): with self.assertRaises(pyfronius.NotSupportedError): await self.fronius.current_storage_data() - async def tearDown(self): + async def asyncTearDown(self): await self.session.close() self.server_control.stop_server() pass diff --git a/tests/test_web_v1.py b/tests/test_web_v1.py index f185413..1089467 100644 --- a/tests/test_web_v1.py +++ b/tests/test_web_v1.py @@ -42,7 +42,7 @@ class NoFroniusWebTest(AsyncTestCaseSetup): session = None fronius = None - async def setUp(self): + async def asyncSetUp(self): # Pick an unused port to ensure the connection attempt fails deterministically self.port = _get_unused_port() self.url = "http://{}:{}".format(ADDRESS, self.port) @@ -104,7 +104,7 @@ class FroniusWebDetectVersionV1(AsyncTestCaseSetup): session = None fronius = None - async def setUp(self): + async def asyncSetUp(self): # Create an arbitrary subclass of TCP Server as the server to be # started # Here, it is an Simple HTTP file serving server @@ -150,7 +150,7 @@ class FroniusWebTestV1(AsyncTestCaseSetup): session = None fronius = None - async def setUp(self): + async def asyncSetUp(self): # Create an arbitrary subclass of TCP Server as the server to be # started # Here, it is an Simple HTTP file serving server @@ -259,7 +259,7 @@ async def test_fronius_fetch(self): ], ) - async def tearDown(self): + async def asyncTearDown(self): await self.session.close() self.server_control.stop_server() pass diff --git a/tests/util.py b/tests/util.py index 66b1091..e0a88c1 100644 --- a/tests/util.py +++ b/tests/util.py @@ -1,34 +1,17 @@ -import asyncio import contextlib import socket - -import aiounittest -from aiounittest import async_test +import unittest ADDRESS = "localhost" -class AsyncTestCaseSetup(aiounittest.AsyncTestCase): - async def setUp(self): +class AsyncTestCaseSetup(unittest.IsolatedAsyncioTestCase): + async def asyncSetUp(self): pass - async def tearDown(self): + async def asyncTearDown(self): pass - def __getattribute__(self, name): - attr = object.__getattribute__(self, name) - if name.startswith("test_") and asyncio.iscoroutinefunction(attr): - - async def wrapped_attr(): - await self.setUp() - await attr() - await self.tearDown() - - res = async_test(wrapped_attr, loop=self.get_event_loop()) - return res - else: - return attr - def _get_unused_port() -> int: """Return an unused localhost port for negative connection tests.""" diff --git a/uv.lock b/uv.lock index d3e079c..24c49a5 100644 --- a/uv.lock +++ b/uv.lock @@ -315,17 +315,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fb/76/641ae371508676492379f16e2fa48f4e2c11741bd63c48be4b12a6b09cba/aiosignal-1.4.0-py3-none-any.whl", hash = "sha256:053243f8b92b990551949e63930a839ff0cf0b0ebbe0597b0f3fb19e1a0fe82e", size = 7490, upload-time = "2025-07-03T22:54:42.156Z" }, ] -[[package]] -name = "aiounittest" -version = "1.5.0" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "wrapt" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/6f/90/f0d1ef74a0c022ac64b42d8a278c8f9cbdf2d5049a8f1e7707f4c5f80358/aiounittest-1.5.0.tar.gz", hash = "sha256:3c20ab00909419749061a4cb1a2755f034d10c1f6455adb1f03d7c16dedce711", size = 7396, upload-time = "2025-03-07T07:33:58.648Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/20/b6/5a02761969f8bf2c8263ce413c6253cb51a7224559c45608fa8f83e00f3a/aiounittest-1.5.0-py3-none-any.whl", hash = "sha256:30e709730e010c7daa1a0e3ce7398beebd2977d4dbf0a2875b8ed55830ab9d34", size = 7027, upload-time = "2025-03-07T07:33:57.381Z" }, -] [[package]] name = "async-timeout" @@ -1740,7 +1729,6 @@ dependencies = [ [package.dev-dependencies] dev = [ - { name = "aiounittest" }, { name = "coverage", version = "7.6.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" }, { name = "coverage", version = "7.10.7", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.9.*'" }, { name = "coverage", version = "7.13.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, @@ -1761,7 +1749,6 @@ requires-dist = [{ name = "aiohttp" }] [package.metadata.requires-dev] dev = [ - { name = "aiounittest", specifier = ">=1.5.0" }, { name = "coverage", specifier = ">=7.6.1" }, { name = "pre-commit", specifier = ">=3.5.0" }, { name = "pyfronius", editable = "." },