Skip to content

Update for Python 3.13 #864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
matrix:
os: [ubuntu]
pyver: ['3.7', '3.8', '3.9', '3.10', '3.11']
pyver: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
redis: ['latest']
ujson: ['']
include:
Expand Down Expand Up @@ -87,6 +87,7 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyver }}
allow-prereleases: true
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install ujson
Expand Down
2 changes: 1 addition & 1 deletion aiocache/backends/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async def _redlock_release(self, key, value):
return await self._raw("eval", self.RELEASE_SCRIPT, 1, key, value)

async def _close(self, *args, _conn=None, **kwargs):
await self.client.close()
await self.client.aclose()


class RedisCache(RedisBackend):
Expand Down
18 changes: 9 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-e .

aiomcache==0.8.0
aiohttp==3.8.3
marshmallow==3.19.0
msgpack==1.0.4
pytest==7.2.0
pytest-asyncio==0.20.3
pytest-cov==4.0.0
pytest-mock==3.10.0
redis==4.4.2
aiomcache==0.8.2
aiohttp==3.9.5
marshmallow==3.21.3
msgpack==1.0.8
pytest==7.4.4
pytest-asyncio==0.23.7
pytest-cov==5.0.0
pytest-mock==3.14.0
redis==5.0.5
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
packages=("aiocache",),
install_requires=None,
extras_require={
"redis": ["redis>=4.2.0"],
"redis": ["redis>=5"],
"memcached": ["aiomcache>=0.5.2"],
"msgpack": ["msgpack>=0.5.5"],
},
Expand Down
9 changes: 5 additions & 4 deletions tests/performance/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,24 @@ async def set(self, key, value):
async def close(self, *_):
await self.cache.close()

cache = web.AppKey("cache", CacheManager)

async def handler_get(req):
try:
data = await req.app["cache"].get("testkey")
data = await req.app[cache].get("testkey")
if data:
return web.Response(text=data)
except asyncio.TimeoutError:
return web.Response(status=404)

data = str(uuid.uuid4())
await req.app["cache"].set("testkey", data)
await req.app[cache].set("testkey", data)
return web.Response(text=str(data))


def run_server(backend: str) -> None:
app = web.Application()
app["cache"] = CacheManager(backend)
app.on_shutdown.append(app["cache"].close)
app[cache] = CacheManager(backend)
app.on_shutdown.append(app[cache].close)
app.router.add_route("GET", "/", handler_get)
web.run_app(app)
2 changes: 1 addition & 1 deletion tests/ut/backends/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async def test_redlock_release(self, mocker, redis):

async def test_close(self, redis):
await redis._close()
assert redis.client.close.call_count == 1
assert redis.client.aclose.call_count == 1


class TestRedisCache:
Expand Down