generated from john/python-template
gpt-5.3-codesx review: Phase 5 Release Readiness & Contract Enforcement
Quality Gate / gate (push) Failing after 10s
Quality Gate / gate (push) Failing after 10s
This commit is contained in:
@@ -7,7 +7,25 @@ import pytest
|
||||
|
||||
from transcription.services.sources import transcribe_document_image
|
||||
|
||||
HAS_OPENROUTER_KEY = bool(os.getenv("OPENROUTER_API_KEY"))
|
||||
|
||||
def _load_openrouter_key_from_dotenv() -> str | None:
|
||||
"""Best-effort read of OPENROUTER_API_KEY from local .env without printing it."""
|
||||
env_path = Path(__file__).resolve().parents[2] / ".env"
|
||||
if not env_path.exists():
|
||||
return None
|
||||
for raw_line in env_path.read_text(encoding="utf-8").splitlines():
|
||||
line = raw_line.strip()
|
||||
if not line or line.startswith("#") or "=" not in line:
|
||||
continue
|
||||
key, value = line.split("=", 1)
|
||||
if key.strip() != "OPENROUTER_API_KEY":
|
||||
continue
|
||||
resolved = value.strip().strip('"').strip("'")
|
||||
return resolved or None
|
||||
return None
|
||||
|
||||
|
||||
HAS_OPENROUTER_KEY = bool(os.getenv("OPENROUTER_API_KEY") or _load_openrouter_key_from_dotenv())
|
||||
|
||||
REAL_IMAGES_DIR = Path(__file__).resolve().parents[1] / "fixtures" / "images" / "real"
|
||||
ARTIFACTS_DIR = Path(__file__).resolve().parents[1] / "artifacts" / "transcriptions"
|
||||
|
||||
Reference in New Issue
Block a user