Skip to content

Commit ee3a9ee

Browse files
committed
chore: skip Gemini tests in local runs
Skip Gemini example tests in local runs to prevent it failing when the user has gcloud configured but not with the ability to run the Gemini APIs as that prevents coverage profiles from being run when developing new features or fixing bugs. Switch test skip from a print to pytest.skip so that its clear that the test didn't actually run. Fixes: #2167
1 parent 78f08f8 commit ee3a9ee

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

docs/graph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ stateDiagram-v2
352352
Feedback --> [*]
353353
```
354354

355-
```python {title="genai_email_feedback.py" py="3.10"}
355+
```python {title="genai_email_feedback.py" py="3.10" test="ci_only"}
356356
from __future__ import annotations as _annotations
357357

358358
from dataclasses import dataclass, field

docs/models/google.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ To use Vertex AI, you may need to set up [application default credentials](https
5858

5959
If you have the [`gcloud` CLI](https://cloud.google.com/sdk/gcloud) installed and configured, you can use:
6060

61-
```python
61+
```python {test="ci_only"}
6262
from pydantic_ai import Agent
6363
from pydantic_ai.models.google import GoogleModel
6464
from pydantic_ai.providers.google import GoogleProvider

tests/test_examples.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def print(self, *args: Any, **kwargs: Any) -> None:
205205
eval_example.lint_ruff(example)
206206

207207
if opt_test.startswith('skip'):
208-
print(opt_test[4:].lstrip(' -') or 'running code skipped')
208+
pytest.skip(opt_test[4:].lstrip(' -') or 'running code skipped')
209+
elif opt_test.startswith('ci_only') and os.environ.get('GITHUB_ACTIONS', '').lower() != 'true':
210+
pytest.skip(opt_test[7:].lstrip(' -') or 'running code skipped in local tests')
209211
else:
210212
test_globals: dict[str, str] = {'__name__': dunder_name}
211213

0 commit comments

Comments
 (0)