Skip to content
This repository was archived by the owner on Feb 18, 2026. It is now read-only.

Commit 16b09c5

Browse files
committed
Remove aiohttp dependency
1 parent 7968d02 commit 16b09c5

11 files changed

+8
-714
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ dependencies = [
2020
"python-dateutil>=2.9.0",
2121
"redis>=7.1.0",
2222
"uvicorn[standard]>=0.32.0",
23-
"aiohttp>=3.8.0"
2423
]
2524

2625
[project.urls]

tests/__init__.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
from gsrest.app import create_app # noqa: E402
1616

1717

18-
class AioHTTPClientShim:
19-
"""Shim to make httpx.AsyncClient look like aiohttp.ClientSession for tests.
18+
class HTTPClientShim:
19+
"""Shim providing async-style API for httpx.AsyncClient.
2020
21-
This allows existing tests that use aiohttp-style API to work with httpx.
21+
Provides await-based response methods for backward compatibility with existing tests.
2222
"""
2323

2424
def __init__(self, httpx_client: AsyncClient):
@@ -27,16 +27,11 @@ def __init__(self, httpx_client: AsyncClient):
2727
async def request(
2828
self, path: str = None, method: str = "GET", json=None, headers=None, **kwargs
2929
):
30-
"""Mimic aiohttp's client.request() API.
31-
32-
aiohttp uses: client.request(path="/foo", method="GET")
33-
httpx uses: client.request(method="GET", url="/foo")
34-
"""
3530
url = path or kwargs.get("url", "/")
3631
response = await self._client.request(
3732
method=method, url=url, json=json, headers=headers
3833
)
39-
return AioHTTPResponseShim(response)
34+
return HTTPResponseShim(response)
4035

4136
async def get(self, path: str, headers=None, **kwargs):
4237
return await self.request(path=path, method="GET", headers=headers, **kwargs)
@@ -47,27 +42,23 @@ async def post(self, path: str, json=None, headers=None, **kwargs):
4742
)
4843

4944

50-
class AioHTTPResponseShim:
51-
"""Shim to make httpx.Response look like aiohttp.ClientResponse for tests."""
45+
class HTTPResponseShim:
46+
"""Shim providing async-style API for httpx.Response."""
5247

5348
def __init__(self, httpx_response):
5449
self._response = httpx_response
5550

5651
@property
5752
def status(self) -> int:
58-
"""aiohttp uses .status, httpx uses .status_code"""
5953
return self._response.status_code
6054

6155
async def read(self) -> bytes:
62-
"""aiohttp uses await response.read(), httpx has response.content"""
6356
return self._response.content
6457

6558
async def text(self) -> str:
66-
"""aiohttp uses await response.text(), httpx has response.text"""
6759
return self._response.text
6860

6961
async def json(self):
70-
"""aiohttp uses await response.json(), httpx has response.json()"""
7162
return self._response.json()
7263

7364
@property
@@ -100,10 +91,7 @@ def __getitem__(self, key):
10091

10192

10293
class BaseTestCase:
103-
"""Base test case for FastAPI tests using httpx.
104-
105-
Maintains backward compatibility with existing aiohttp-style tests.
106-
"""
94+
"""Base test case for FastAPI tests using httpx."""
10795

10896
config: dict = None # Set by conftest.py
10997
app = None # Will be set during setup
@@ -131,8 +119,7 @@ async def setup_client(self):
131119
async with AsyncClient(
132120
transport=transport, base_url="http://test"
133121
) as httpx_client:
134-
# Wrap httpx client in aiohttp-compatible shim
135-
self.client = AioHTTPClientShim(httpx_client)
122+
self.client = HTTPClientShim(httpx_client)
136123
self._httpx_client = (
137124
httpx_client # Keep reference for direct access if needed
138125
)

tests/test_addresses_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.addresses_service as test_service
105

tests/test_blocks_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.blocks_service as test_service
105

tests/test_bulk_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.bulk_service as test_service
105

tests/test_entities_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.entities_service as test_service
105

tests/test_rates_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.rates_service as test_service
105

tests/test_tags_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.tags_service as test_service
105

tests/test_tokens_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.tokens_service as test_service
105

tests/test_txs_controller.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# coding: utf-8
22

3-
import pytest
4-
import json
5-
from aiohttp import web
6-
from aiohttp.test_utils import unittest_run_loop
7-
83
from tests import BaseTestCase
94
import gsrest.test.txs_service as test_service
105

0 commit comments

Comments
 (0)