Skip to content

Commit f5d2856

Browse files
committed
Update examples
1 parent be7abb3 commit f5d2856

File tree

24 files changed

+70
-62
lines changed

24 files changed

+70
-62
lines changed

examples/miniapps/aiohttp/README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ The output should be something like:
9898

9999
.. code-block::
100100
101-
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
102-
plugins: asyncio-0.16.0, anyio-3.3.4, aiohttp-0.3.0, cov-3.0.0
101+
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
102+
plugins: cov-6.0.0, anyio-4.4.0, asyncio-0.24.0, aiohttp-1.0.5
103+
asyncio: mode=Mode.STRICT, default_loop_scope=None
103104
collected 3 items
104105
105106
giphynavigator/tests.py ... [100%]

examples/miniapps/aiohttp/giphynavigator/tests.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@
33
from unittest import mock
44

55
import pytest
6+
import pytest_asyncio
67

78
from giphynavigator.application import create_app
89
from giphynavigator.giphy import GiphyClient
910

1011

12+
pytestmark = pytest.mark.asyncio
13+
14+
1115
@pytest.fixture
1216
def app():
1317
app = create_app()
1418
yield app
1519
app.container.unwire()
1620

1721

18-
@pytest.fixture
19-
def client(app, aiohttp_client, loop):
20-
return loop.run_until_complete(aiohttp_client(app))
22+
@pytest_asyncio.fixture
23+
async def client(app, aiohttp_client):
24+
return await aiohttp_client(app)
2125

2226

2327
async def test_index(client, app):

examples/miniapps/aiohttp/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ dependency-injector
22
aiohttp
33
pyyaml
44
pytest-aiohttp
5+
pytest-asyncio
56
pytest-cov

examples/miniapps/asyncio-daemon/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-buster
1+
FROM python:3.13-bookworm
22

33
ENV PYTHONUNBUFFERED=1
44

examples/miniapps/asyncio-daemon/README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Build the Docker image:
1313

1414
.. code-block:: bash
1515
16-
docker-compose build
16+
docker compose build
1717
1818
Run the docker-compose environment:
1919

2020
.. code-block:: bash
2121
22-
docker-compose up
22+
docker compose up
2323
2424
The output should be something like:
2525

@@ -59,7 +59,7 @@ To run the tests do:
5959

6060
.. code-block:: bash
6161
62-
docker-compose run --rm monitor py.test monitoringdaemon/tests.py --cov=monitoringdaemon
62+
docker compose run --rm monitor py.test monitoringdaemon/tests.py --cov=monitoringdaemon
6363
6464
The output should be something like:
6565

examples/miniapps/fastapi-redis/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-buster
1+
FROM python:3.13-bookworm
22

33
ENV PYTHONUNBUFFERED=1
44

examples/miniapps/fastapi-redis/README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ Build the Docker image:
1212

1313
.. code-block:: bash
1414
15-
docker-compose build
15+
docker compose build
1616
1717
Run the docker-compose environment:
1818

1919
.. code-block:: bash
2020
21-
docker-compose up
21+
docker compose up
2222
2323
The output should be something like:
2424

@@ -54,16 +54,16 @@ To run the tests do:
5454

5555
.. code-block:: bash
5656
57-
docker-compose run --rm example py.test fastapiredis/tests.py --cov=fastapiredis
57+
docker compose run --rm example py.test fastapiredis/tests.py --cov=fastapiredis
5858
5959
The output should be something like:
6060

6161
.. code-block::
6262
63-
platform linux -- Python 3.10.9, pytest-7.2.0, pluggy-1.0.0
63+
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
6464
rootdir: /code
65-
plugins: cov-4.0.0, asyncio-0.20.3
66-
collected 1 item
65+
plugins: cov-6.0.0, asyncio-0.24.0, anyio-4.7.0
66+
asyncio: mode=Mode.STRICT, default_loop_scope=None
6767
6868
fastapiredis/tests.py . [100%]
6969
@@ -77,4 +77,4 @@ The output should be something like:
7777
fastapiredis/services.py 7 3 57%
7878
fastapiredis/tests.py 18 0 100%
7979
-------------------------------------------------
80-
TOTAL 52 7 87%
80+
TOTAL 52 7 87%

examples/miniapps/fastapi-redis/fastapiredis/redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import AsyncIterator
22

3-
from aioredis import from_url, Redis
3+
from redis.asyncio import from_url, Redis
44

55

66
async def init_redis_pool(host: str, password: str) -> AsyncIterator[Redis]:

examples/miniapps/fastapi-redis/fastapiredis/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Services module."""
22

3-
from aioredis import Redis
3+
from redis.asyncio import Redis
44

55

66
class Service:

examples/miniapps/fastapi-redis/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependency-injector
22
fastapi
33
uvicorn
4-
aioredis
4+
redis>=4.2
55

66
# For testing:
77
pytest

0 commit comments

Comments
 (0)