From 61267587e1d18437b3a0cbcb59790955c0dba3cc Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Wed, 20 May 2026 11:06:36 -0700 Subject: [PATCH] Move the scripts for testing examples to examples/.test_scripts --- .github/workflows/ci.yml | 2 +- .../{ => .test_scripts}/check-examples.py | 4 ++-- examples/{ => .test_scripts}/run-examples.py | 22 +++++++++---------- .../run-with-patched-model.py | 7 +++--- runtests | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) rename examples/{ => .test_scripts}/check-examples.py (95%) rename examples/{ => .test_scripts}/run-examples.py (93%) rename examples/{ => .test_scripts}/run-with-patched-model.py (95%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a0491c8..59d2b91d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,4 +25,4 @@ jobs: - run: uv run pytest - - run: uv run examples/check-examples.py + - run: uv run examples/.test_scripts/check-examples.py diff --git a/examples/check-examples.py b/examples/.test_scripts/check-examples.py similarity index 95% rename from examples/check-examples.py rename to examples/.test_scripts/check-examples.py index 8b0cc2cc..2bf5a996 100755 --- a/examples/check-examples.py +++ b/examples/.test_scripts/check-examples.py @@ -2,7 +2,7 @@ """Typecheck all example directories with mypy. Usage (from repo root): - uv run examples/check-examples.py + uv run examples/.test_scripts/check-examples.py """ import os @@ -10,7 +10,7 @@ import sys from pathlib import Path -REPO = Path(__file__).resolve().parent.parent +REPO = Path(__file__).resolve().parent.parent.parent MYPY_VERSION = "mypy>=1.11" # Each entry: (display name, directory to check, extra --with deps) diff --git a/examples/run-examples.py b/examples/.test_scripts/run-examples.py similarity index 93% rename from examples/run-examples.py rename to examples/.test_scripts/run-examples.py index 05328a24..d2b3751e 100755 --- a/examples/run-examples.py +++ b/examples/.test_scripts/run-examples.py @@ -2,17 +2,17 @@ """Run examples and report results. Usage (from repo root): - uv run examples/run-examples.py # text-only samples - uv run examples/run-examples.py --image # also run image samples - uv run examples/run-examples.py --video # also run video samples - uv run examples/run-examples.py --e2e # also run e2e test scripts - uv run examples/run-examples.py --all # run everything - uv run examples/run-examples.py --parallel # run in parallel - uv run examples/run-examples.py stream.py tools_schema.py + uv run examples/.test_scripts/run-examples.py # text-only samples + uv run examples/.test_scripts/run-examples.py --image # also image samples + uv run examples/.test_scripts/run-examples.py --video # also video samples + uv run examples/.test_scripts/run-examples.py --e2e # also e2e test scripts + uv run examples/.test_scripts/run-examples.py --all # everything + uv run examples/.test_scripts/run-examples.py --parallel # in parallel + uv run examples/.test_scripts/run-examples.py stream.py tools_schema.py # run selected example files - uv run examples/run-examples.py --model gateway:openai/gpt-5.4-mini + uv run examples/.test_scripts/run-examples.py --model MODEL # patch ai.get_model() to use the given model for every sample - uv run examples/run-examples.py --protocol=responses + uv run examples/.test_scripts/run-examples.py --protocol=responses # patch model/provider helpers and ai.stream()/ai.generate() """ @@ -24,9 +24,9 @@ import sys from pathlib import Path -REPO = Path(__file__).resolve().parent.parent +REPO = Path(__file__).resolve().parent.parent.parent SAMPLES = REPO / "examples" / "samples" -PATCH_SCRIPT = REPO / "examples" / "run-with-patched-model.py" +PATCH_SCRIPT = REPO / "examples" / ".test_scripts" / "run-with-patched-model.py" @dataclasses.dataclass diff --git a/examples/run-with-patched-model.py b/examples/.test_scripts/run-with-patched-model.py similarity index 95% rename from examples/run-with-patched-model.py rename to examples/.test_scripts/run-with-patched-model.py index 7769e1e9..5e485da0 100644 --- a/examples/run-with-patched-model.py +++ b/examples/.test_scripts/run-with-patched-model.py @@ -6,11 +6,12 @@ Usage (from repo root): - uv run examples/run-with-patched-model.py - uv run examples/run-with-patched-model.py --protocol=responses + uv run examples/.test_scripts/run-with-patched-model.py + uv run examples/.test_scripts/run-with-patched-model.py \\ + --protocol=responses Example: - uv run examples/run-with-patched-model.py \\ + uv run examples/.test_scripts/run-with-patched-model.py \\ gateway:openai/gpt-5.4-mini \\ examples/samples/stream.py diff --git a/runtests b/runtests index 101c306e..84f90e29 100755 --- a/runtests +++ b/runtests @@ -25,4 +25,4 @@ echo "=== pytest ===" uv run pytest echo "=== check-examples ===" -uv run examples/check-examples.py +uv run examples/.test_scripts/check-examples.py