Port pydantic-ai's A2A integration tests + wire CI to run them#57
Conversation
Adds `tests/test_pydantic_ai.py` (11 tests) covering the `fasta2a.pydantic_ai`
bridge end-to-end: pydantic model outputs with JSON schema, lifespan
required-or-runtime-error, text/file/data Part round-trips, error handling,
multi-task context sharing, thinking responses, history splicing, and
multi-message conversations. Ported verbatim from `tests/test_a2a.py` in
`pydantic/pydantic-ai`; snapshots transferred unchanged because the bridge
code is identical.
CI:
- `main.yml` now triggers on `release/**` branches too (not just `main`)
- Install step adds `--extra pydantic-ai`; the extra is marker-gated to
Python 3.10+, so on 3.9 it resolves to nothing and the test file
short-circuits via `pytest.importorskip('pydantic_ai')`
Dev deps:
- Added `anyio` (explicit), `dirty-equals` (matchers in snapshots)
- Added `tests/assets/kiwi.jpg` (copied from pydantic-ai test assets)
After this, `pydantic-ai`'s in-tree `tests/test_a2a.py` can be safely
dropped in the v2-exec PR since the same coverage now lives upstream.
|
Thx @dsfaccini for opening this, that will help to have better coverage indeed CI is failing with lint errors https://github.com/datalayer/fasta2a/actions/runs/25979237907/job/76911386271?pr=57 |
ruff doesn't raise E402 on imports following the importorskip/TYPE_CHECKING preamble, so RUF100 flagged the suppressions as dead. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
scripts/check runs pyright, which must resolve the bridge's pydantic_ai imports. pydantic-ai-slim is marker-gated to Python 3.10+, so running the check across the test matrix failed on the 3.9 row where the extra resolves to nothing. The new lint job pins 3.12; the test matrix now runs only scripts/test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
hey @echarles sorry I was working on pydantic-ai v2 for the past week, so just got back to this. gonna merge this one, then update the PR I have against main |
|
Tx @dsfaccini - what is the goal of the |
|
hey @echarles , the after that release in October last year, 6 commits with breaking changes were made in march that stayed unreleased in order for me to migrate the pydantic ai integration into here and release it, so we can link it and users can use it immediately, I had to either merge the pyai bridge onto main and release a #55 is green and folds all changes done in now I just need to migrate the existing issue in the pydantic ai repo onto here (3 issues) |
|
Thx for the explanation. I will review #55 asap |
Summary
Brings the A2A integration tests over from
pydantic/pydantic-ai'stests/test_a2a.pyso thefasta2a.pydantic_aibridge has real CI coverage upstream. After this lands,pydantic-aican safely drop its in-treetests/test_a2a.pyin the v2-exec PR (companion: pydantic/pydantic-ai#5426 merged 2026-05-15, follow-up v2-exec PR pending).What's covered
tests/test_pydantic_ai.py(11 tests, ported verbatim — snapshots transferred unchanged because the bridge code is identical):state='failed')context_idaccumulates message history)tasks/sendCI changes
.github/workflows/main.yml:release/**branches (so this branch's CI fires)--extra pydantic-ai; the extra is marker-gated to Python 3.10+, so on the 3.9 matrix row it resolves to nothing and the test file short-circuits viapytest.importorskip('pydantic_ai')Dev deps
anyio(explicit; previously transitive)dirty-equals(forIsStr/IsDatetime/IsNowmatchers used ininline-snapshotsnapshots)tests/assets/kiwi.jpgfor the file-content test (~100KB)Verification
scripts/checkclean (ruff format/check, pyright 0/0/0 with file-levelreportUnknownVariableType/reportUnknownArgumentTypesuppression — the bridge raises ImportError when pydantic-ai is missing so pyright sees an Unknown branch on every call);scripts/test16/16 pass (5 existing + 11 new); coverage onfasta2a/pydantic_ai/_bridge.pyjumps from 0% to 89%.