diff --git a/docs/user/tutorial-asgi.rst b/docs/user/tutorial-asgi.rst index 12b9682c0..65ffa2fa9 100644 --- a/docs/user/tutorial-asgi.rst +++ b/docs/user/tutorial-asgi.rst @@ -859,7 +859,7 @@ any problems with importing local utility modules or checking code coverage:: $ mkdir -p tests $ touch tests/__init__.py -Next, let's implement fixtures to replace ``uuid`` and ``aioredis``, and inject them +Next, let's implement fixtures to replace ``uuid`` and ``redis``, and inject them into our tests via ``conftest.py`` (place your code in the newly created ``tests`` directory): diff --git a/examples/asgilook/asgilook/config.py b/examples/asgilook/asgilook/config.py index 9b997d413..e5ac12c5b 100644 --- a/examples/asgilook/asgilook/config.py +++ b/examples/asgilook/asgilook/config.py @@ -1,19 +1,15 @@ import os import pathlib +import redis.asyncio import uuid -def from_url_wrapper(url): - pool = redis.ConnectionPool.from_url(url) - return redis.Redis.from_pool(pool) - - class Config: DEFAULT_CONFIG_PATH = '/tmp/asgilook' DEFAULT_MIN_THUMB_SIZE = 64 + DEFAULT_REDIS_FROM_URL = redis.asyncio.from_url DEFAULT_REDIS_HOST = 'redis://localhost' DEFAULT_UUID_GENERATOR = uuid.uuid4 - DEFAULT_REDIS_FROM_URL = from_url_wrapper def __init__(self): self.storage_path = pathlib.Path( diff --git a/examples/asgilook/requirements/asgilook b/examples/asgilook/requirements/asgilook index c0081cbf5..7f716db72 100644 --- a/examples/asgilook/requirements/asgilook +++ b/examples/asgilook/requirements/asgilook @@ -1,4 +1,4 @@ aiofiles>=0.4.0 -aioredis>=2.0 +redis>=5.0 msgpack Pillow>=6.0.0