Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import ctrlgen_with_nullable_schema
import ctrlgen_with_resp_schema

os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.

os.environ["GOOGLE_CLOUD_LOCATION"] = "global" # "us-central1"
# The project name is included in the CICD pipeline
# os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name"
Expand Down
2 changes: 1 addition & 1 deletion genai/count_tokens/test_count_tokens_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import counttoken_with_txt
import counttoken_with_txt_vid

os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.

os.environ["GOOGLE_CLOUD_LOCATION"] = "global" # "us-central1"
# The project name is included in the CICD pipeline
# os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name"
Expand Down
2 changes: 1 addition & 1 deletion genai/safety/test_safety_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import safety_with_txt


os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.

os.environ["GOOGLE_CLOUD_LOCATION"] = "global" # "us-central1"
# The project name is included in the CICD pipeline
# os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name"
Expand Down
2 changes: 1 addition & 1 deletion genai/text_generation/test_text_generation_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import textgen_with_youtube_video
import thinking_textgen_with_txt

os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.

os.environ["GOOGLE_CLOUD_LOCATION"] = "global" # "us-central1"
# The project name is included in the CICD pipeline
# os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name"
Expand Down
2 changes: 1 addition & 1 deletion genai/thinking/test_thinking_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import thinking_includethoughts_with_txt
import thinking_with_txt

os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "True"
os.environ["GOOGLE_GENAI_USE_ENTERPRISE"] = "True"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Setting environment variables at the module level, especially after imports, can lead to issues if any imported modules initialize clients at the module level. It also causes global state mutation that can affect other tests in the suite. Consider using a pytest fixture with monkeypatch for better isolation. Additionally, note that Vertex AI (Enterprise) typically requires a regional location (e.g., us-central1) rather than global; you may need to update GOOGLE_CLOUD_LOCATION to ensure compatibility.

os.environ["GOOGLE_CLOUD_LOCATION"] = "global" # "us-central1"
# The project name is included in the CICD pipeline
# os.environ['GOOGLE_CLOUD_PROJECT'] = "add-your-project-name"
Expand Down