File tree Expand file tree Collapse file tree 2 files changed +35
-24
lines changed Expand file tree Collapse file tree 2 files changed +35
-24
lines changed Original file line number Diff line number Diff line change 6
6
import asyncio
7
7
import contextlib
8
8
import re
9
+ import sys
9
10
import uuid
10
11
from collections .abc import Callable
11
12
from dataclasses import dataclass , field
17
18
from pydantic_ai import Agent
18
19
from pydantic_ai .models .test import TestModel
19
20
21
+ has_required_python : bool = sys .version_info >= (3 , 10 )
20
22
has_ag_ui : bool = False
21
- with contextlib .suppress (ImportError ):
22
- from ag_ui .core import (
23
- AssistantMessage ,
24
- CustomEvent ,
25
- DeveloperMessage ,
26
- EventType ,
27
- FunctionCall ,
28
- Message ,
29
- RunAgentInput ,
30
- StateSnapshotEvent ,
31
- SystemMessage ,
32
- Tool ,
33
- ToolCall ,
34
- ToolMessage ,
35
- UserMessage ,
36
- )
23
+ if has_required_python :
24
+ with contextlib .suppress (ImportError ):
25
+ from ag_ui .core import (
26
+ AssistantMessage ,
27
+ CustomEvent ,
28
+ DeveloperMessage ,
29
+ EventType ,
30
+ FunctionCall ,
31
+ Message ,
32
+ RunAgentInput ,
33
+ StateSnapshotEvent ,
34
+ SystemMessage ,
35
+ Tool ,
36
+ ToolCall ,
37
+ ToolMessage ,
38
+ UserMessage ,
39
+ )
37
40
38
- from adapter_ag_ui ._enums import Role
39
- from adapter_ag_ui .adapter import AdapterAGUI
41
+ from adapter_ag_ui ._enums import Role
42
+ from adapter_ag_ui .adapter import AdapterAGUI
40
43
41
- has_ag_ui = True
44
+ has_ag_ui = True
42
45
43
46
44
- pytestmark = [pytest .mark .anyio , pytest .mark .skipif (not has_ag_ui , reason = 'adapter-ag-ui not installed' )]
47
+ pytestmark = [
48
+ pytest .mark .anyio ,
49
+ pytest .mark .skipif (not has_required_python , reason = 'requires Python 3.10 or higher' ),
50
+ pytest .mark .skipif (has_required_python and not has_ag_ui , reason = 'adapter-ag-ui not installed' ),
51
+ ]
45
52
46
53
# Type aliases.
47
54
_MockUUID = Callable [[], str ]
Original file line number Diff line number Diff line change 4
4
5
5
import contextlib
6
6
import logging
7
+ import sys
7
8
from dataclasses import dataclass , field
8
9
from typing import Final
9
10
12
13
from pydantic_ai import Agent
13
14
from pydantic_ai .models .test import TestModel
14
15
16
+ has_required_python : bool = sys .version_info >= (3 , 10 )
15
17
has_ag_ui : bool = False
16
- with contextlib .suppress (ImportError ):
17
- from adapter_ag_ui .adapter import _LOGGER as adapter_logger , AdapterAGUI # type: ignore[reportPrivateUsage]
18
+ if has_required_python :
19
+ with contextlib .suppress (ImportError ):
20
+ from adapter_ag_ui .adapter import _LOGGER as adapter_logger , AdapterAGUI # type: ignore[reportPrivateUsage]
18
21
19
- has_ag_ui = True
22
+ has_ag_ui = True
20
23
21
24
22
25
pytestmark = [
23
26
pytest .mark .anyio ,
24
- 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' ),
28
+ pytest .mark .skipif (has_required_python and not has_ag_ui , reason = 'adapter-ag-ui not installed' ),
25
29
]
26
30
27
31
# Constants.
You can’t perform that action at this time.
0 commit comments