plutoV2_miniProject_3rd-yr / mp1 /test_gemini_key.py
3v324v23's picture
Add application file
66ad25b
raw
history blame contribute delete
517 Bytes
import os
from pathlib import Path
import pytest
from dotenv import load_dotenv
from google import genai
load_dotenv(Path(__file__).resolve().with_name(".env"))
pytestmark = pytest.mark.live_api
def test_gemini():
api_key = os.getenv("GOOGLE_API_KEY")
if not api_key:
pytest.skip("GOOGLE_API_KEY not configured")
client = genai.Client(api_key=api_key)
response = client.models.generate_content(
model="gemini-2.0-flash",
contents=["Hello"],
)
assert response.text