fix(tutorials): add pytest-asyncio to async tutorial dev deps - #481
Merged
deepthi-rao-scale merged 1 commit intoJul 30, 2026
Merged
Conversation
The test images for five async tutorials install only `.[dev]`, but their tests import pytest_asyncio and those tutorials do not list pytest-asyncio (or httpx) in their pyproject dev extras. As a result `docker exec ... pytest tests/test_agent.py` fails at collection with `ModuleNotFoundError: No module named 'pytest_asyncio'`. Declare pytest-asyncio and httpx in each tutorial's dev optional-dependencies, matching the tutorials that already run their async tests correctly (e.g. 110_pydantic_ai, all of 00_sync). This keeps the test deps with the project so they also work when running pytest locally, not just inside the built image. Affected: - 10_async/00_base/090_multi_agent_non_temporal - 10_async/10_temporal/060_open_ai_agents_sdk_hello_world - 10_async/10_temporal/070_open_ai_agents_sdk_tools - 10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop - 10_async/10_temporal/090_claude_agents_sdk_mvp Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
deepthi-rao-scale
force-pushed
the
fix/tutorial-agents-missing-pytest-asyncio
branch
from
July 30, 2026 17:57
1af69c8 to
ab6044d
Compare
deepthi-rao-scale
marked this pull request as ready for review
July 30, 2026 17:59
declan-scale
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Run Integration Testsjobs for four async SDK tutorials fail at pytest collection:Tutorial tests run via
docker exec <agent> pytest tests/test_agent.pyinside the agent image. These tutorials'tests/test_agent.pyimport pytest_asyncioand use@pytest_asyncio.fixture, but the dependency is provided nowhere: it's not in their pyprojectdevextras, and the image installs only.[dev].Fix
Declare
pytest-asyncioandhttpxin each affected tutorial'sdevoptional-dependencies, souv pip install .[dev]picks them up. This matches the tutorials that already run their async tests correctly (e.g.110_pydantic_ai, all of00_sync), and keeps the test deps with the project — sopytestalso works when run locally, not just inside the built image.dev = [ "pytest", + "pytest-asyncio", + "httpx", "black", "isort", "flake8", ]Affected tutorials:
10_async/00_base/090_multi_agent_non_temporal(latent — not currently in the CI matrix)10_async/10_temporal/060_open_ai_agents_sdk_hello_world10_async/10_temporal/070_open_ai_agents_sdk_tools10_async/10_temporal/080_open_ai_agents_sdk_human_in_the_loop10_async/10_temporal/090_claude_agents_sdk_mvpHow the set was determined
Enumerated every tutorial whose
test_agent.pyimportspytest_asyncio, then kept only those where neither the pyprojectdevextras nor the Dockerfile provide it — exactly the four red CI jobs plus one latent case.🤖 Generated with Claude Code
Greptile Summary
This PR fixes pytest collection failures in five async tutorial packages by declaring
pytest-asyncioandhttpxasdevoptional-dependencies in each tutorial'spyproject.toml. Without these entries,uv pip install .[dev]inside the agent image omitted both packages, causing an immediateModuleNotFoundErrorwhen pytest tried to collecttest_agent.py.pytest-asyncioandhttpxto the[project.optional-dependencies] devsection of fivepyproject.tomlfiles across10_async/00_base/090_multi_agent_non_temporaland four10_async/10_temporal/0{60..90}_*tutorials.110_pydantic_ai), keeping test dependencies co-located with the project for both local and Docker-based runs.Confidence Score: 5/5
All five files receive an identical, minimal additive change to dev-only dependencies; no production code or runtime behaviour is touched.
Every change is a two-line addition of well-known test tooling to dev optional-dependencies. The fix directly mirrors the working pattern used by other tutorials in the same repo, the test files confirm both imports are required, and there is no risk of side effects on the installed agent images in production.
Files Needing Attention: No files require special attention; all changes are confined to dev dependency declarations in tutorial pyproject.toml files.
Important Files Changed
Sequence Diagram
sequenceDiagram participant CI as CI Job participant Docker as Docker Image Build participant uv as uv pip install .[dev] participant pytest as pytest (inside container) CI->>Docker: Build agent image Docker->>uv: Install project + dev extras Note over uv: Before PR: pytest-asyncio & httpx missing from dev uv-->>Docker: packages installed (pytest-asyncio absent) CI->>pytest: pytest tests/test_agent.py pytest-->>CI: ❌ ModuleNotFoundError: No module named 'pytest_asyncio' Note over uv: After PR: pytest-asyncio & httpx declared in dev Docker->>uv: Install project + dev extras uv-->>Docker: packages installed (pytest-asyncio ✓, httpx ✓) CI->>pytest: pytest tests/test_agent.py pytest-->>CI: ✅ Tests collected and runReviews (1): Last reviewed commit: "fix(tutorials): add pytest-asyncio to as..." | Re-trigger Greptile