Skip to content

Commit e6a62cf

Browse files
euri10cofin
authored andcommitted
add service
1 parent 6353016 commit e6a62cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/examples/usage/usage_migrations_1.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
__all__ = ("test_async_methods",)
22

33

4-
async def test_async_methods() -> None:
4+
from pytest_databases.docker.postgres import PostgresService
5+
6+
7+
async def test_async_methods(postgres_service: PostgresService) -> None:
58
# start-example
69
from sqlspec.adapters.asyncpg import AsyncpgConfig
710

11+
dsn = (
12+
f"postgresql://{postgres_service.user}:{postgres_service.password}"
13+
f"@{postgres_service.host}:{postgres_service.port}/{postgres_service.database}"
14+
)
815
config = AsyncpgConfig(
9-
pool_config={"dsn": "postgresql://user:pass@localhost/mydb"},
10-
migration_config={"enabled": True, "script_location": "migrations"},
16+
pool_config={"dsn": dsn}, migration_config={"enabled": True, "script_location": "migrations"}
1117
)
1218

1319
# Apply migrations

0 commit comments

Comments
 (0)