""" Test Configuration ================== pytest conftest.py - 確保測試環境變數在所有模組載入前生效 Phase 13.1: GitHub Webhook 測試需要這些環境變數 """ import os # ============================================================================= # 關鍵: 在任何 import 之前設定環境變數 # ============================================================================= # pytest 會在所有 test_ 模組之前載入 conftest.py # 這確保 settings singleton 建立時能讀到正確的測試值 os.environ.setdefault("MOCK_MODE", "true") os.environ.setdefault("ENVIRONMENT", "dev") os.environ.setdefault("GITEA_WEBHOOK_SECRET", "test-secret-key-12345") os.environ.setdefault("GITEA_ALLOWED_REPOS", "test-owner/test-repo,wooo/awoooi") # ============================================================================= # Pytest Plugins # ============================================================================= pytest_plugins = ["pytest_asyncio"]