Skip to content

Commit 9487756

Browse files
committed
chore(ag-ui): only run tests on python 3.10 and above
Limit ag-ui tests to run on Python 3.10 and above as it makes use of match statements which are not available in earlier versions.
1 parent 1b5fcac commit 9487756

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tests/adapter_ag_ui/test_adapter.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import asyncio
77
import contextlib
88
import re
9+
import sys
910
import uuid
1011
from collections.abc import Callable
1112
from dataclasses import dataclass, field
@@ -17,6 +18,7 @@
1718
from pydantic_ai import Agent
1819
from pydantic_ai.models.test import TestModel
1920

21+
has_required_python: bool = sys.version_info >= (3, 10)
2022
has_ag_ui: bool = False
2123
with contextlib.suppress(ImportError):
2224
from ag_ui.core import (
@@ -41,7 +43,11 @@
4143
has_ag_ui = True
4244

4345

44-
pytestmark = [pytest.mark.anyio, pytest.mark.skipif(not has_ag_ui, reason='adapter-ag-ui not installed')]
46+
pytestmark = [
47+
pytest.mark.anyio,
48+
pytest.mark.skipif(not has_ag_ui, reason='adapter-ag-ui not installed'),
49+
pytest.mark.skipif(not has_required_python, reason='requires Python 3.10 or higher'),
50+
]
4551

4652
# Type aliases.
4753
_MockUUID = Callable[[], str]

tests/test_ag_ui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import contextlib
66
import logging
7+
import sys
78
from dataclasses import dataclass, field
89
from typing import Final
910

@@ -12,6 +13,7 @@
1213
from pydantic_ai import Agent
1314
from pydantic_ai.models.test import TestModel
1415

16+
has_required_python: bool = sys.version_info >= (3, 10)
1517
has_ag_ui: bool = False
1618
with contextlib.suppress(ImportError):
1719
from adapter_ag_ui.adapter import _LOGGER as adapter_logger, AdapterAGUI # type: ignore[reportPrivateUsage]
@@ -22,6 +24,7 @@
2224
pytestmark = [
2325
pytest.mark.anyio,
2426
pytest.mark.skipif(not has_ag_ui, reason='adapter-ag-ui not installed'),
27+
pytest.mark.skipif(not has_required_python, reason='requires Python 3.10 or higher'),
2528
]
2629

2730
# Constants.

0 commit comments

Comments
 (0)