Skip to content

Commit e082336

Browse files
authored
ci: Add GitHub Action to automatically run unit tests (#52)
1 parent b80cb22 commit e082336

File tree

2 files changed

+66
-5
lines changed

2 files changed

+66
-5
lines changed

.github/workflows/unit-tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
name: Test with Python ${{ matrix.python-version }}
14+
15+
runs-on: ubuntu-latest
16+
17+
if: github.repository == 'google/a2a-python'
18+
19+
strategy:
20+
matrix:
21+
python-version: ["3.13"]
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install uv
33+
run: |
34+
curl -LsSf https://astral.sh/uv/install.sh | sh
35+
36+
- name: Add uv to PATH
37+
run: |
38+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
39+
40+
- name: Install dependencies
41+
run: uv sync --dev
42+
43+
- name: Run tests
44+
run: uv run pytest
45+
46+
- name: Upload coverage report
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: coverage-report-${{ matrix.python-version }}
50+
path: coverage.xml
51+
if-no-files-found: ignore

tests/server/request_handlers/test_jsonrpc_handler.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ async def streaming_coro():
527527
json={
528528
'contextId': 'session-xyz',
529529
'id': 'task_123',
530+
'kind': 'task',
530531
'status': {'state': 'submitted'},
531-
'type': 'task',
532532
},
533533
),
534534
call(
@@ -537,13 +537,18 @@ async def streaming_coro():
537537
'artifacts': [
538538
{
539539
'artifactId': '11',
540-
'parts': [{'text': 'text', 'type': 'text'}],
540+
'parts': [
541+
{
542+
'kind': 'text',
543+
'text': 'text',
544+
}
545+
],
541546
}
542547
],
543548
'contextId': 'session-xyz',
544549
'id': 'task_123',
550+
'kind': 'task',
545551
'status': {'state': 'submitted'},
546-
'type': 'task',
547552
},
548553
),
549554
call(
@@ -552,13 +557,18 @@ async def streaming_coro():
552557
'artifacts': [
553558
{
554559
'artifactId': '11',
555-
'parts': [{'text': 'text', 'type': 'text'}],
560+
'parts': [
561+
{
562+
'kind': 'text',
563+
'text': 'text',
564+
}
565+
],
556566
}
557567
],
558568
'contextId': 'session-xyz',
559569
'id': 'task_123',
570+
'kind': 'task',
560571
'status': {'state': 'completed'},
561-
'type': 'task',
562572
},
563573
),
564574
]

0 commit comments

Comments
 (0)