diff --git a/README.md b/README.md
index 44fe7a1..42562bf 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ It is designed to offer pre-configured testing setups for many different types a
`pytest-databases` currently utilizes `docker compose` (or the legacy `docker-compose`) commands to manage the startup and shutdown of each database service. The following databases are currently available:
-- **Postgres**: Version 12, 13, 14, 15, and 16 are available
+- **Postgres**: Version 12, 13, 14, 15, 16 and 17 are available
- **MySQL**: Version 5.6, 5.7 and 8 are available
- **Oracle**: Version 18c XE and 23C Free are available
- **SQL Server**: Version 2022 is available
diff --git a/docs/index.rst b/docs/index.rst
index 9609856..9bfd667 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -20,9 +20,17 @@ Installing ``pytest-databases`` is as easy as calling your favorite Python packa
python3 -m pip install pytest-databases
- .. tab-item:: pipx
+ .. tab-item:: uv
:sync: key2
+ .. code-block:: bash
+ :caption: Using `uv `_
+
+ uv add pytest-databases
+
+ .. tab-item:: pipx
+ :sync: key3
+
.. code-block:: bash
:caption: Using `pipx `_
diff --git a/src/pytest_databases/docker/docker-compose.postgres.yml b/src/pytest_databases/docker/docker-compose.postgres.yml
index 596d7d0..edab03e 100644
--- a/src/pytest_databases/docker/docker-compose.postgres.yml
+++ b/src/pytest_databases/docker/docker-compose.postgres.yml
@@ -39,6 +39,14 @@ services:
- "${POSTGRES16_PORT:-5427}:5432" # use a non-standard port here
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
+ postgres17:
+ networks:
+ - default
+ image: postgres:17
+ ports:
+ - "${POSTGRES17_PORT:-5428}:5432" # use a non-standard port here
+ environment:
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-super-secret}
networks:
default:
driver: bridge
diff --git a/src/pytest_databases/docker/postgres.py b/src/pytest_databases/docker/postgres.py
index b2c4264..7469964 100644
--- a/src/pytest_databases/docker/postgres.py
+++ b/src/pytest_databases/docker/postgres.py
@@ -93,15 +93,19 @@ def postgres15_port() -> int:
def postgres16_port() -> int:
return 5427
+@pytest.fixture(scope="session")
+def postgres17_port() -> int:
+ return 5428
+
@pytest.fixture(scope="session")
def default_postgres_service_name() -> str:
- return "postgres16"
+ return "postgres17"
@pytest.fixture(scope="session")
-def postgres_port(postgres16_port: int) -> int:
- return postgres16_port
+def postgres_port(postgres17_port: int) -> int:
+ return postgres17_port
@pytest.fixture(scope="session")
@@ -249,6 +253,33 @@ def postgres16_service(
return postgres_docker_services
+@pytest.fixture(autouse=False, scope="session")
+def postgres17_service(
+ postgres_docker_services: DockerServiceRegistry,
+ postgres_docker_compose_files: list[Path],
+ postgres17_port: int,
+ postgres_database: str,
+ postgres_user: str,
+ postgres_password: str,
+) -> Generator[DockerServiceRegistry, None, None]:
+ os.environ["POSTGRES_PASSWORD"] = postgres_password
+ os.environ["POSTGRES_USER"] = postgres_user
+ os.environ["POSTGRES_DATABASE"] = postgres_database
+ os.environ["POSTGRES17_PORT"] = str(postgres17_port)
+ postgres_docker_services.start(
+ "postgres17",
+ docker_compose_files=postgres_docker_compose_files,
+ timeout=45,
+ pause=1,
+ check=postgres_responsive,
+ port=postgres17_port,
+ database=postgres_database,
+ user=postgres_user,
+ password=postgres_password,
+ )
+ yield postgres_docker_services
+
+
# alias to the latest
@pytest.fixture(autouse=False, scope="session")
def postgres_service(
@@ -298,6 +329,25 @@ def postgres_startup_connection(
) as conn:
yield conn
+@pytest.fixture(autouse=False, scope="session")
+def postgres17_startup_connection(
+ postgres17_service: DockerServiceRegistry,
+ postgres_docker_ip: str,
+ postgres17_port: int,
+ postgres_database: str,
+ postgres_user: str,
+ postgres_password: str,
+) -> Generator[psycopg.Connection, None, None]:
+ with psycopg.connect(
+ _make_connection_string(
+ host=postgres_docker_ip,
+ port=postgres17_port,
+ user=postgres_user,
+ password=postgres_password,
+ database=postgres_database,
+ ),
+ ) as conn:
+ yield conn
@pytest.fixture(autouse=False, scope="session")
def postgres16_startup_connection(
diff --git a/tests/docker/test_postgres.py b/tests/docker/test_postgres.py
index 74ec326..be983e9 100644
--- a/tests/docker/test_postgres.py
+++ b/tests/docker/test_postgres.py
@@ -21,8 +21,8 @@ def test_postgres_default_config(
postgres_user: str,
postgres_password: str,
) -> None:
- assert default_postgres_service_name == "postgres16"
- assert postgres_port == 5427
+ assert default_postgres_service_name == "postgres17"
+ assert postgres_port == 5428
assert postgres_database == "postgres"
assert postgres_user == "postgres"
assert postgres_password == "super-secret"
@@ -87,6 +87,16 @@ def test_postgres_16_config(
assert postgres_user == "postgres"
assert postgres_password == "super-secret"
+def test_postgres_17_config(
+ postgres17_port: int,
+ postgres_database: str,
+ postgres_user: str,
+ postgres_password: str,
+) -> None:
+ assert postgres17_port == 5428
+ assert postgres_database == "postgres"
+ assert postgres_user == "postgres"
+ assert postgres_password == "super-secret"
def test_postgres_services(
postgres_docker_ip: str,
@@ -195,6 +205,29 @@ def test_postgres_16_services(
)
assert ping
+def test_postgres_17_services(
+ postgres_docker_ip: str,
+ postgres17_service: DockerServiceRegistry,
+ postgres17_port: int,
+ postgres_database: str,
+ postgres_user: str,
+ postgres_password: str,
+) -> None:
+ ping = postgres_responsive(
+ postgres_docker_ip,
+ port=postgres17_port,
+ database=postgres_database,
+ user=postgres_user,
+ password=postgres_password,
+ )
+ assert ping
+
+def test_postgres_17_services_after_start(
+ postgres17_startup_connection: psycopg.Connection,
+) -> None:
+ postgres17_startup_connection.execute("CREATE TABLE if not exists simple_table as SELECT 1")
+ result = postgres17_startup_connection.execute("select * from simple_table").fetchone()
+ assert bool(result is not None and result[0] == 1)
def test_postgres_16_services_after_start(
postgres16_startup_connection: psycopg.Connection,