diff --git a/Dockerfile b/Dockerfile index d94c3bf..6a99778 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN pip install uv COPY pyproject.toml uv.lock* README.md /app/ -RUN uv sync --extra dev --frozen +RUN uv sync --extra dev ENV PATH="/app/.venv/bin:$PATH" diff --git a/compose.yml b/compose.yml index 7aae9d6..004bd5f 100644 --- a/compose.yml +++ b/compose.yml @@ -14,7 +14,6 @@ services: - ./guard_agent:/app/guard_agent:z - ./tests:/app/tests:z - ./pyproject.toml:/app/pyproject.toml:z - - ./uv.lock:/app/uv.lock:z depends_on: redis: condition: service_started diff --git a/tests/test_adapter_django.py b/tests/test_adapter_django.py index b6860ef..accd4a5 100644 --- a/tests/test_adapter_django.py +++ b/tests/test_adapter_django.py @@ -1,5 +1,7 @@ from __future__ import annotations +import os + from django.conf import settings from django.http import HttpRequest, JsonResponse from django.test import Client @@ -10,12 +12,14 @@ API_KEY = "test-api-key-1234567890" PROJECT_ID = "test-project" +REDIS_URL = os.getenv("REDIS_URL") or "redis://localhost:6379" settings.GUARD_SECURITY_CONFIG = SecurityConfig( enable_agent=True, agent_api_key=API_KEY, agent_project_id=PROJECT_ID, passive_mode=True, + redis_url=REDIS_URL, ) diff --git a/tests/test_adapter_flask.py b/tests/test_adapter_flask.py index c6c7504..a4cbc26 100644 --- a/tests/test_adapter_flask.py +++ b/tests/test_adapter_flask.py @@ -11,6 +11,7 @@ unit tests for ``guard_agent/client.py``. """ +import os import warnings import pytest @@ -20,6 +21,8 @@ from guard_agent.models import AgentConfig +REDIS_URL = os.getenv("REDIS_URL") or "redis://localhost:6379" + pytestmark = pytest.mark.filterwarnings( "ignore:coroutine .* was never awaited:RuntimeWarning" ) @@ -46,6 +49,7 @@ def _build_app(self) -> Flask: agent_api_key=self.API_KEY, agent_project_id=self.PROJECT_ID, passive_mode=True, + redis_url=REDIS_URL, ) FlaskAPIGuard(app, config=config) @@ -87,6 +91,7 @@ def test_deferred_init_app_pattern(self) -> None: agent_api_key=self.API_KEY, agent_project_id=self.PROJECT_ID, passive_mode=True, + redis_url=REDIS_URL, ) guard = FlaskAPIGuard() app = Flask(__name__) diff --git a/tests/test_logging_utils.py b/tests/test_logging_utils.py index 7c7bafa..e656c58 100644 --- a/tests/test_logging_utils.py +++ b/tests/test_logging_utils.py @@ -214,7 +214,7 @@ def test_console_handler_emits_only_without_host_handlers(self) -> None: try: setup_agent_logging() handler = logging.getLogger(GUARD_AGENT_LOGGER_NAME).handlers[0] - assert handler.filter(make_record()) is True + assert handler.filter(make_record()) finally: root.handlers = original_handlers