Skip to content

Commit ecabbe6

Browse files
authored
fix(generative-ai): Fix flaky tests (GoogleCloudPlatform#11757)
* fix(generative-ai): Fix a flaky test * Skip PDF sample test for now as model output is likely blocked. * Skip reasoning engine advanced sample test * Remove unreliable asserts * Skip reasoning engine basic test for now
1 parent ac23046 commit ecabbe6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

generative_ai/gemini_reasoning_engine_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
import os
16-
import sys
16+
1717
from typing import Generator
1818

1919
import pytest
@@ -37,13 +37,12 @@ def reasoning_engine_id() -> Generator[str, None, None]:
3737
)
3838

3939

40-
@pytest.mark.skipif(
41-
sys.version_info >= (3, 12), reason="requires Python version lower than 3.12"
42-
)
40+
@pytest.mark.skip("TODO: Reasoning Engine Deployment Issue b/339643184")
4341
def test_create_reasoning_engine_basic(reasoning_engine_id: str) -> None:
4442
assert reasoning_engine_id
4543

4644

45+
@pytest.mark.skip("TODO: Reasoning Engine Deployment Issue b/339643184")
4746
def test_create_reasoning_engine_advanced() -> None:
4847
reasoning_engine = gemini_reasoning_engine.create_reasoning_engine_advanced(
4948
PROJECT_ID, REGION, STAGING_BUCKET

generative_ai/test_gemini_examples.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def test_gemini_guide_example() -> None:
4444
text = gemini_guide_example.generate_text(PROJECT_ID)
4545
text = text.lower()
4646
assert len(text) > 0
47-
assert "scones" in text
4847

4948

5049
def test_gemini_text_input_example() -> None:
@@ -69,7 +68,6 @@ def test_gemini_pro_config_example() -> None:
6968
text = gemini_pro_config_example.generate_text(PROJECT_ID)
7069
text = text.lower()
7170
assert len(text) > 0
72-
assert any(e in text for e in ("blueberry", "coffee", "flower", "table"))
7371

7472
# clean-up
7573
os.remove(fname)
@@ -107,6 +105,7 @@ def test_gemini_single_turn_video_example() -> None:
107105
assert any([_ in text for _ in ("zoo", "tiger", "leaf", "water")])
108106

109107

108+
@pytest.mark.skip("TODO: Safty filters are likely blocking model output b/339985493")
110109
def test_gemini_pdf_example() -> None:
111110
text = gemini_pdf_example.analyze_pdf(PROJECT_ID)
112111
assert len(text) > 0

0 commit comments

Comments
 (0)