From 40ae4a862e00475a5b1c205045986475a790f39c Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sat, 31 Oct 2026 08:43:03 +0100 Subject: build: add storage backend dependency groups Provide matching published extras and uv groups for Redis, Valkey, Memcached, MongoDB, and PostgreSQL so deployments can install the clients required by their selected rate-limit or Huey backend. Keep shared backend groups aligned where Redis dependencies are used by both Flask-Limiter and Huey. --- tests/test_optional_dependencies.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/test_optional_dependencies.py (limited to 'tests') diff --git a/tests/test_optional_dependencies.py b/tests/test_optional_dependencies.py new file mode 100644 index 0000000..40c53c5 --- /dev/null +++ b/tests/test_optional_dependencies.py @@ -0,0 +1,38 @@ +# SPDX-FileCopyrightText: 2026 Dennis Fink +# +# SPDX-License-Identifier: BSD-3-Clause + +"""Check optional client dependencies for supported storage backends.""" + +import tomllib +from pathlib import Path + +import pytest + + +BACKENDS = { + "redis": ["flask-limiter[redis]>=4.1.1", "huey[redis]>=3.3.0"], + "valkey": ["flask-limiter[valkey]>=4.1.1", "huey[redis]>=3.3.0"], + "memcached": ["flask-limiter[memcached]>=4.1.1"], + "mongodb": ["flask-limiter[mongodb]>=4.1.1"], + "postgres": ["huey[postgres]>=3.1.0"], +} + + +@pytest.mark.parametrize("backend", BACKENDS) +def test_storage_backend_has_matching_extra_and_uv_group(backend: str) -> None: + project_root = Path(__file__).resolve().parents[1] + metadata = tomllib.loads((project_root / "pyproject.toml").read_text()) + + expected = BACKENDS[backend] + assert metadata["project"]["optional-dependencies"][backend] == expected + assert metadata["dependency-groups"][backend] == expected + assert metadata["tool"]["uv"]["default-groups"] == ["dev", "test"] + + +def test_no_legacy_ratelimit_only_groups() -> None: + project_root = Path(__file__).resolve().parents[1] + metadata = tomllib.loads((project_root / "pyproject.toml").read_text()) + assert not any( + group.startswith("ratelimit-") for group in metadata["dependency-groups"] + ) -- cgit v1.3.1