From bc032a37a20a38ebc3a6b9bc7fe342d4e3e5411c Mon Sep 17 00:00:00 2001 From: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> Date: Wed, 5 Jun 2024 16:44:57 +0200 Subject: [PATCH] Fix tests skipping for Google AI integration (#788) --- .../google_ai/tests/generators/chat/test_chat_gemini.py | 4 ++-- integrations/google_ai/tests/generators/test_gemini.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integrations/google_ai/tests/generators/chat/test_chat_gemini.py b/integrations/google_ai/tests/generators/chat/test_chat_gemini.py index 730b01422..1b9ce4b1e 100644 --- a/integrations/google_ai/tests/generators/chat/test_chat_gemini.py +++ b/integrations/google_ai/tests/generators/chat/test_chat_gemini.py @@ -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. @@ -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 = [ diff --git a/integrations/google_ai/tests/generators/test_gemini.py b/integrations/google_ai/tests/generators/test_gemini.py index df94ce3d3..35c7d196b 100644 --- a/integrations/google_ai/tests/generators/test_gemini.py +++ b/integrations/google_ai/tests/generators/test_gemini.py @@ -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")