Skip to content

Commit

Permalink
Bump aiomcache from 0.6.0 to 0.7.0 (#665)
Browse files Browse the repository at this point in the history
* Bump aiomcache from 0.6.0 to 0.7.0

Bumps [aiomcache](https://github.com/aio-libs/aiomcache) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/aio-libs/aiomcache/releases)
- [Changelog](https://github.com/aio-libs/aiomcache/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiomcache@v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: aiomcache
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Type fixes

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sam Bull <git@sambull.org>
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
  • Loading branch information
3 people authored Jan 28, 2022
1 parent 29ddff3 commit 936f763
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions aiohttp_session/memcached_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class MemcachedStorage(AbstractStorage):
"""Memcached storage"""

def __init__( # type: ignore[no-any-unimported] # TODO: aiomcache
def __init__(
self,
memcached_conn: aiomcache.Client,
*,
Expand Down Expand Up @@ -48,7 +48,7 @@ async def load_session(self, request: web.Request) -> Session:
else:
key = str(cookie)
stored_key = (self.cookie_name + "_" + key).encode("utf-8")
data = await self.conn.get(stored_key)
data = await self.conn.get(stored_key) # type: ignore[call-overload]
if data is None:
return Session(None, data=None, new=True, max_age=self.max_age)
data = data.decode("utf-8")
Expand Down
2 changes: 1 addition & 1 deletion demo/memcached_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async def handler(request: web.Request) -> web.Response:

async def make_app() -> web.Application:
app = web.Application()
mc = aiomcache.Client("127.0.0.1", 11211, loop=loop)
mc = aiomcache.Client("127.0.0.1", 11211)
setup(app, MemcachedStorage(mc))
app.router.add_get("/", handler)
return app
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-e .
aiohttp==3.8.1
aiomcache==0.6.0
aiomcache==0.7.0
aioredis==2.0.0
attrs==21.4.0
chardet==4.0.0
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def memcached_server( # type: ignore[misc] # No docker types.
delay = 0.1
for _i in range(20):
try:
conn = aiomcache.Client(host, port, loop=event_loop)
conn = aiomcache.Client(host, port)
event_loop.run_until_complete(conn.set(b"foo", b"bar"))
break
except ConnectionRefusedError:
Expand All @@ -208,9 +208,9 @@ def memcached_params( # type: ignore[misc]


@pytest.fixture
def memcached( # type: ignore[misc]
def memcached(
event_loop: asyncio.AbstractEventLoop, memcached_params: _MemcachedParams
) -> Iterator[aiomcache.Client]:
conn = aiomcache.Client(loop=event_loop, **memcached_params)
conn = aiomcache.Client(**memcached_params)
yield conn
event_loop.run_until_complete(conn.close())
6 changes: 3 additions & 3 deletions tests/test_memcached_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def load_cookie(
cookies = client.session.cookie_jar.filter_cookies(client.make_url("/"))
key = cookies["AIOHTTP_SESSION"]
storage_key = ("AIOHTTP_SESSION_" + key.value).encode("utf-8")
encoded = await memcached.get(storage_key)
encoded = await memcached.get(storage_key) # type: ignore[call-overload]
s = encoded.decode("utf-8")
return cast(Dict[str, Any], json.loads(s))

Expand Down Expand Up @@ -181,7 +181,7 @@ async def handler(request: web.Request) -> web.StreamResponse:
assert morsel["httponly"]
assert morsel["path"] == "/"
storage_key = ("AIOHTTP_SESSION_" + morsel.value).encode("utf-8")
exists = await memcached.get(storage_key)
exists = await memcached.get(storage_key) # type: ignore[call-overload]
assert exists


Expand Down Expand Up @@ -298,7 +298,7 @@ async def get_value(request: web.Request) -> web.StreamResponse:
storage_key = ("AIOHTTP_SESSION_" + resp.cookies["AIOHTTP_SESSION"].value).encode(
"utf-8"
)
storage_value = await memcached.get(storage_key)
storage_value = await memcached.get(storage_key) # type: ignore[call-overload]
storage_value = json.loads(storage_value.decode("utf-8"))
assert storage_value["session"]["stored"] == "TEST_VALUE"

Expand Down

0 comments on commit 936f763

Please sign in to comment.