File size: 891 Bytes
9c9ce67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
"""
Lightweight smoke test for Gemini artifact generation.
- If GEMINI_API_KEY is missing: prints friendly error and exits 0 (app won't crash).
- If key is present: calls Gemini with a tiny prompt; prints OK or error; exits 0 on OK, 1 on error.
Do not store GEMINI_API_KEY in CI; use only for local or optional CI jobs that need it.
"""
import os
import sys

# Ensure repo root is on path (run from repo root: python scripts/test_gemini_smoke.py)
_repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if _repo_root not in sys.path:
    sys.path.insert(0, _repo_root)

from backend.gemini_client import smoke_check

if __name__ == "__main__":
    result = smoke_check()
    print(result)
    if result == "OK":
        sys.exit(0)
    if result.startswith("SKIP:"):
        sys.exit(0)  # key missing is expected in CI; don't fail
    sys.exit(1)