Skip to content

fix(tutorials): install pytest-asyncio in async agent images so their tests run - #480

Closed
deepthi-rao-scale wants to merge 1 commit into
nextfrom
fix/tutorial-async-test-deps
Closed

fix(tutorials): install pytest-asyncio in async agent images so their tests run#480
deepthi-rao-scale wants to merge 1 commit into
nextfrom
fix/tutorial-async-test-deps

Conversation

@deepthi-rao-scale

@deepthi-rao-scale deepthi-rao-scale commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

The integration suite runs each tutorial agent's test_agent.py inside its published image. The async agents' tests use @pytest.mark.asyncio, but their Dockerfiles installed only .[dev] — which does not include pytest-asyncio. So the tests fail to import:

E   ModuleNotFoundError: No module named 'pytest_asyncio'
❌ Test attempt failed with exit code 2   (x3 retries → job fails)

100_gemini_litellm was worse — it installed just . (no dev deps at all).

This is why unrelated PRs (e.g. scale-agentex #385) keep going red on 060/070/080/090/110/... — the failure is a missing test dependency in the images, not the PR's code.

Fix

Bring the 13 async agents in line with the agents that already work (010_agent_chat, 020_state_machine, etc.), which install .[dev] pytest-asyncio httpx:

-RUN uv pip install --system .[dev]
+RUN uv pip install --system .[dev] pytest-asyncio httpx

Sync agents (00_sync/*) are untouched — their tests are synchronous and pass without pytest-asyncio.

Effect

Once released and the images are rebuilt, each async agent's test_agent.py can import and run, and the 10-async-* integration jobs pass.

🤖 Generated with Claude Code

Greptile Summary

This PR adds pytest-asyncio and httpx to the uv pip install line in 13 async tutorial agent Dockerfiles, matching the pattern already used by working agents. The missing packages were causing ModuleNotFoundError: No module named 'pytest_asyncio' when the integration suite ran each agent's test_agent.py inside its published image.

  • 12 of 13 agents are fully fixed: each already had COPY \u2026 /tests and COPY test_utils in its Dockerfile and only needed the install line updated.
  • 100_gemini_litellm had the worst starting state (bare . install) and receives the same install fix, but has no tests/ directory in the repo and no corresponding COPY instructions in its Dockerfile \u2014 so its integration job will still have nothing to run after the image is rebuilt.

Confidence Score: 4/5

Safe to merge — the one-line install change is correct and unblocks 12 of the 13 agents; only 100_gemini_litellm remains incomplete.

Twelve agents get a complete fix: they already had their test files copied into the image and just needed pytest-asyncio and httpx added to the install command. The thirteenth, 100_gemini_litellm, has no tests/ directory in the repo at all and no COPY instructions for tests or test_utils in its Dockerfile, so its integration job will still produce no runnable tests after the image is rebuilt.

Files Needing Attention: examples/tutorials/10_async/10_temporal/100_gemini_litellm/Dockerfile — needs a tests/ directory created and corresponding COPY instructions added alongside the install fix.

Important Files Changed

Filename Overview
examples/tutorials/10_async/00_base/090_multi_agent_non_temporal/Dockerfile Adds pytest-asyncio and httpx to the uv install line; test and test_utils COPY instructions already present.
examples/tutorials/10_async/10_temporal/060_open_ai_agents_sdk_hello_world/Dockerfile Adds pytest-asyncio and httpx; COPY for tests/test_utils already present.
examples/tutorials/10_async/10_temporal/100_gemini_litellm/Dockerfile Upgrades install from . to .[dev] pytest-asyncio httpx, but this agent has no tests directory and no COPY for tests/test_utils — integration tests will still not run.
examples/tutorials/10_async/10_temporal/110_pydantic_ai/Dockerfile Adds pytest-asyncio and httpx; COPY for tests/test_utils already present.
examples/tutorials/10_async/10_temporal/150_codex/Dockerfile Adds pytest-asyncio and httpx; COPY for tests/test_utils already present.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Integration Suite] --> B{Agent Image}
    B --> C[COPY project/]
    B --> D[COPY tests/]
    B --> E[COPY test_utils/]
    C --> F["uv pip install .[dev] pytest-asyncio httpx"]
    D --> F
    E --> F
    F --> G[pytest runs test_agent.py]
    G --> H{pytest-asyncio present?}
    H -- Yes --> I[Tests pass]
    H -- No --> J[ModuleNotFoundError]

    subgraph gemini[100_gemini_litellm still incomplete]
        K[COPY project/]
        L["uv pip install .[dev] pytest-asyncio httpx"]
        M[No tests directory or COPY in Dockerfile]
    end

    K --> L
    L --> M
Loading

Comments Outside Diff (1)

  1. examples/tutorials/10_async/10_temporal/100_gemini_litellm/Dockerfile, line 39-43 (link)

    P1 Missing tests COPY — integration test still won't run

    pytest-asyncio is now installed, but there is no tests directory in this agent (confirmed: the tree shows only project/, pyproject.toml, README.md, and .dockerignore), and the Dockerfile does not COPY a tests directory or test_utils into the image. Every other agent fixed in this PR has both COPY ... /tests and COPY test_utils /app/test_utils before the RUN line. For 100_gemini_litellm, the integration runner will still fail — either "no tests found" or a missing module — because the test files are never placed in the image.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: examples/tutorials/10_async/10_temporal/100_gemini_litellm/Dockerfile
    Line: 39-43
    
    Comment:
    **Missing tests COPY — integration test still won't run**
    
    `pytest-asyncio` is now installed, but there is no `tests` directory in this agent (confirmed: the tree shows only `project/`, `pyproject.toml`, `README.md`, and `.dockerignore`), and the Dockerfile does not `COPY` a `tests` directory or `test_utils` into the image. Every other agent fixed in this PR has both `COPY ... /tests` and `COPY test_utils /app/test_utils` before the `RUN` line. For `100_gemini_litellm`, the integration runner will still fail — either "no tests found" or a missing module — because the test files are never placed in the image.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

    Fix in Cursor Fix in Claude Code Fix in Codex

Fix All in Cursor Fix All in Claude Code Fix All in Codex

Prompt To Fix All With AI
### Issue 1
examples/tutorials/10_async/10_temporal/100_gemini_litellm/Dockerfile:39-43
**Missing tests COPY — integration test still won't run**

`pytest-asyncio` is now installed, but there is no `tests` directory in this agent (confirmed: the tree shows only `project/`, `pyproject.toml`, `README.md`, and `.dockerignore`), and the Dockerfile does not `COPY` a `tests` directory or `test_utils` into the image. Every other agent fixed in this PR has both `COPY ... /tests` and `COPY test_utils /app/test_utils` before the `RUN` line. For `100_gemini_litellm`, the integration runner will still fail — either "no tests found" or a missing module — because the test files are never placed in the image.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "fix(tutorials): install pytest-asyncio i..." | Re-trigger Greptile

… tests can run

The integration suite runs each agent's test_agent.py inside its published
image. The async tutorial agents' tests use @pytest.mark.asyncio, but their
Dockerfiles installed only .[dev] (which lacks pytest-asyncio), so the tests
failed to import with 'ModuleNotFoundError: No module named pytest_asyncio'
(exit code 2, all retries). 100_gemini_litellm installed just '.', so it had
no test deps at all.

Bring all 13 async agents in line with the already-working ones (e.g.
010_agent_chat, 020_state_machine): install '.[dev] pytest-asyncio httpx'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants