From b976fac645a134910caa6633d3c4b3df5a2f0338 Mon Sep 17 00:00:00 2001 From: Francis Secada Date: Wed, 4 Feb 2026 16:13:25 -0500 Subject: [PATCH] fix(ci): add test environment variables to prevent import errors Issue: CI failing with "UndefinedValueError: SECRET_KEY not found" Root Cause: Settings modules load env vars at import time, before conftest.py can set TESTING=true Fix: Add minimal test environment variables to CI workflow - SECRET_KEY for security module - Database credentials (not used, but required for imports) - API keys (fake values for testing, not used) - Reddit credentials (not used in tests) All values are fake/test-only and do not expose real credentials. Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/test.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb940c7..52c1087 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,6 +35,26 @@ jobs: uv run pytest --cov=src --cov-report=xml --cov-report=term env: PYTHONPATH: src + # Test environment variables + TESTING: "true" + DEBUG: "false" + SECRET_KEY: "test-secret-key-for-ci-only" + # Database (not used in tests, but required for imports) + SQL_DIALECT: "sqlite" + LOCAL_DB_UN: "test" + LOCAL_DB_PW: "test" + LOCAL_DB_DB: "test" + LOCAL_DB_HOST: "localhost" + LOCAL_DB_PORT: "5432" + # API keys (not used in tests, but required for imports) + OPENAI_API_KEY: "sk-test-fake-key" + ANTHROPIC_API_KEY: "sk-ant-test-fake-key" + TAVILY_API_KEY: "test-key" + # Reddit (not used in tests) + REDDIT_CLIENT_ID: "test" + REDDIT_CLIENT_SECRET: "test" + REDDIT_USER_AGENT: "test" + REDDIT_SUBREDDIT: "test" - name: Upload coverage to Codecov uses: codecov/codecov-action@v4