Skip to content

Commit 1424d3e

Browse files
committed
Update examples
1 parent be7abb3 commit 1424d3e

File tree

24 files changed

+69
-62
lines changed

24 files changed

+69
-62
lines changed

Diff for: examples/miniapps/aiohttp/README.rst

+3-2
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%]

Diff for: examples/miniapps/aiohttp/giphynavigator/tests.py

+7-3
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):

Diff for: examples/miniapps/aiohttp/requirements.txt

+1
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

Diff for: examples/miniapps/asyncio-daemon/Dockerfile

+1-1
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

Diff for: examples/miniapps/asyncio-daemon/README.rst

+3-3
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

Diff for: examples/miniapps/fastapi-redis/Dockerfile

+1-1
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

Diff for: examples/miniapps/fastapi-redis/README.rst

+7-7
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%

Diff for: examples/miniapps/fastapi-redis/fastapiredis/redis.py

+1-1
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]:

Diff for: examples/miniapps/fastapi-redis/fastapiredis/services.py

+1-1
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:

Diff for: examples/miniapps/fastapi-redis/requirements.txt

+1-1
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

Diff for: examples/miniapps/fastapi-simple/tests.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
from unittest import mock
22

33
import pytest
4+
import pytest_asyncio
45
from httpx import ASGITransport, AsyncClient
56

67
from fastapi_di_example import app, container, Service
78

89

9-
@pytest.fixture
10-
async def client(event_loop):
10+
@pytest_asyncio.fixture
11+
async def client():
1112
async with AsyncClient(
1213
transport=ASGITransport(app=app),
1314
base_url="http://test",

Diff for: examples/miniapps/fastapi-sqlalchemy/Dockerfile

+1-1
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
ENV HOST=0.0.0.0

Diff for: examples/miniapps/fastapi-sqlalchemy/README.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Build the Docker image:
1515

1616
.. code-block:: bash
1717
18-
docker-compose build
18+
docker compose build
1919
2020
Run the docker-compose environment:
2121

2222
.. code-block:: bash
2323
24-
docker-compose up
24+
docker compose up
2525
2626
The output should be something like:
2727

@@ -67,15 +67,15 @@ To run the tests do:
6767

6868
.. code-block:: bash
6969
70-
docker-compose run --rm webapp py.test webapp/tests.py --cov=webapp
70+
docker compose run --rm webapp py.test webapp/tests.py --cov=webapp
7171
7272
The output should be something like:
7373

7474
.. code-block::
7575
76-
platform linux -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
76+
platform linux -- Python 3.13.1, pytest-8.3.4, pluggy-1.5.0
7777
rootdir: /code
78-
plugins: cov-3.0.0
78+
plugins: cov-6.0.0, anyio-4.7.0
7979
collected 7 items
8080
8181
webapp/tests.py ....... [100%]

Diff for: examples/miniapps/fastapi-sqlalchemy/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dependency-injector
2-
fastapi
2+
fastapi[standard]
33
uvicorn
44
pyyaml
55
sqlalchemy

Diff for: examples/miniapps/fastapi/README.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ The output should be something like:
101101

102102
.. code-block::
103103
104-
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
105-
plugins: asyncio-0.16.0, cov-3.0.0
106-
collected 3 items
104+
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
105+
plugins: cov-6.0.0, anyio-4.4.0, asyncio-0.24.0, aiohttp-1.0.5
106+
asyncio: mode=Mode.STRICT, default_loop_scope=None
107107
108108
giphynavigator/tests.py ... [100%]
109109

Diff for: examples/miniapps/fastapi/giphynavigator/tests.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
from unittest import mock
44

55
import pytest
6+
import pytest_asyncio
67
from httpx import ASGITransport, AsyncClient
78

89
from giphynavigator.application import app
910
from giphynavigator.giphy import GiphyClient
1011

1112

12-
@pytest.fixture
13+
@pytest_asyncio.fixture
1314
async def client():
1415
async with AsyncClient(
1516
transport=ASGITransport(app=app),

Diff for: examples/miniapps/flask-blueprints/README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ The output should be something like:
8181

8282
.. code-block::
8383
84-
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
85-
plugins: cov-3.0.0, flask-1.2.0
84+
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
85+
plugins: cov-6.0.0, flask-1.3.0
86+
asyncio: mode=Mode.STRICT, default_loop_scope=None
8687
collected 2 items
8788
8889
githubnavigator/tests.py .. [100%]

Diff for: examples/miniapps/flask-blueprints/githubnavigator/application.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Application module."""
22

33
from flask import Flask
4-
from flask_bootstrap import Bootstrap
4+
from flask_bootstrap import Bootstrap4
55

66
from .containers import Container
77
from .blueprints import example
@@ -15,7 +15,7 @@ def create_app() -> Flask:
1515
app.container = container
1616
app.register_blueprint(example.blueprint)
1717

18-
bootstrap = Bootstrap()
18+
bootstrap = Bootstrap4()
1919
bootstrap.init_app(app)
2020

2121
return app

Diff for: examples/miniapps/flask/README.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ The output should be something like:
8181

8282
.. code-block::
8383
84-
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
85-
plugins: cov-3.0.0, flask-1.2.0
84+
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
85+
plugins: cov-6.0.0, flask-1.3.0
86+
asyncio: mode=Mode.STRICT, default_loop_scope=None
8687
collected 2 items
8788
8889
githubnavigator/tests.py .. [100%]

Diff for: examples/miniapps/flask/githubnavigator/application.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Application module."""
22

33
from flask import Flask
4-
from flask_bootstrap import Bootstrap
4+
from flask_bootstrap import Bootstrap4
55

66
from .containers import Container
77
from . import views
@@ -15,7 +15,7 @@ def create_app() -> Flask:
1515
app.container = container
1616
app.add_url_rule("/", "index", views.index)
1717

18-
bootstrap = Bootstrap()
18+
bootstrap = Bootstrap4()
1919
bootstrap.init_app(app)
2020

2121
return app

Diff for: examples/miniapps/movie-lister/README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ The output should be something like:
5858

5959
.. code-block::
6060
61-
platform darwin -- Python 3.10.0, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
62-
plugins: cov-3.0.0
61+
platform linux -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
62+
plugins: cov-6.0.0
6363
collected 2 items
6464
6565
movies/tests.py .. [100%]

Diff for: examples/miniapps/sanic/README.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To run the application do:
2727
.. code-block:: bash
2828
2929
export GIPHY_API_KEY=wBJ2wZG7SRqfrU9nPgPiWvORmloDyuL0
30-
python -m giphynavigator
30+
sanic giphynavigator.application:create_app
3131
3232
The output should be something like:
3333

@@ -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: sanic-1.9.1, anyio-3.3.4, 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
103+
asyncio: mode=Mode.STRICT, default_loop_scope=None
103104
collected 3 items
104105
105106
giphynavigator/tests.py ... [100%]

0 commit comments

Comments
 (0)