Skip to content

Commit

Permalink
Fix tests skipping for Google AI integration (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza authored Jun 5, 2024
1 parent 48422b1 commit bc032a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_from_dict(monkeypatch):
assert isinstance(gemini._model, GenerativeModel)


@pytest.mark.skipif("GOOGLE_API_KEY" not in os.environ, reason="GOOGLE_API_KEY not set")
@pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set")
def test_run():
# We're ignoring the unused function argument check since we must have that argument for the test
# to run successfully, but we don't actually use it.
Expand Down Expand Up @@ -227,7 +227,7 @@ def get_current_weather(location: str, unit: str = "celsius"): # noqa: ARG001
assert len(res["replies"]) > 0


@pytest.mark.skipif("GOOGLE_API_KEY" not in os.environ, reason="GOOGLE_API_KEY not set")
@pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set")
def test_past_conversation():
gemini_chat = GoogleAIGeminiChatGenerator(model="gemini-pro")
messages = [
Expand Down
2 changes: 1 addition & 1 deletion integrations/google_ai/tests/generators/test_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def test_from_dict(monkeypatch):
assert isinstance(gemini._model, GenerativeModel)


@pytest.mark.skipif("GOOGLE_API_KEY" not in os.environ, reason="GOOGLE_API_KEY not set")
@pytest.mark.skipif(not os.environ.get("GOOGLE_API_KEY", None), reason="GOOGLE_API_KEY env var not set")
def test_run():
gemini = GoogleAIGeminiGenerator(model="gemini-pro")
res = gemini.run("Tell me something cool")
Expand Down

0 comments on commit bc032a3

Please sign in to comment.