Skip to content

Commit ecc9f2c

Browse files
committed
feat: add support for postgres17rc1
1 parent d479fde commit ecc9f2c

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/pytest_databases/docker/docker-compose.postgres.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ services:
3939
- "${POSTGRES16_PORT:-5427}:5432" # use a non-standard port here
4040
environment:
4141
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
42+
postgres17:
43+
networks:
44+
- default
45+
image: postgres:17rc1
46+
ports:
47+
- "${POSTGRES17_PORT:-5428}:5432" # use a non-standard port here
48+
environment:
49+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
4250
networks:
4351
default:
4452
driver: bridge

src/pytest_databases/docker/postgres.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ def postgres15_port() -> int:
9696
def postgres16_port() -> int:
9797
return 5427
9898

99+
@pytest.fixture(scope="session")
100+
def postgres17_port() -> int:
101+
return 5428
102+
99103

100104
@pytest.fixture(scope="session")
101105
def default_postgres_service_name() -> str:
@@ -252,6 +256,33 @@ def postgres16_service(
252256
yield postgres_docker_services
253257

254258

259+
@pytest.fixture(autouse=False, scope="session")
260+
def postgres17_service(
261+
postgres_docker_services: DockerServiceRegistry,
262+
postgres_docker_compose_files: list[Path],
263+
postgres17_port: int,
264+
postgres_database: str,
265+
postgres_user: str,
266+
postgres_password: str,
267+
) -> Generator[DockerServiceRegistry, None, None]:
268+
os.environ["POSTGRES_PASSWORD"] = postgres_password
269+
os.environ["POSTGRES_USER"] = postgres_user
270+
os.environ["POSTGRES_DATABASE"] = postgres_database
271+
os.environ["POSTGRES17_PORT"] = str(postgres17_port)
272+
postgres_docker_services.start(
273+
"postgres17",
274+
docker_compose_files=postgres_docker_compose_files,
275+
timeout=45,
276+
pause=1,
277+
check=postgres_responsive,
278+
port=postgres17_port,
279+
database=postgres_database,
280+
user=postgres_user,
281+
password=postgres_password,
282+
)
283+
yield postgres_docker_services
284+
285+
255286
# alias to the latest
256287
@pytest.fixture(autouse=False, scope="session")
257288
def postgres_service(

0 commit comments

Comments
 (0)