Skip to content

Commit 092907c

Browse files
committed
Update
1 parent a71397d commit 092907c

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

tests/install_smoke/__main__.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
import importlib
66
import sys
77

8-
from typing import TYPE_CHECKING
9-
10-
from tests.install_smoke.runtime import base_send_message
11-
12-
13-
if TYPE_CHECKING:
14-
from collections.abc import Callable
15-
168

179
# Modules under each list MUST be importable with only that profile's
1810
# extras installed -- no leakage from other extras (grpc, http-server,
@@ -84,10 +76,10 @@
8476
}
8577

8678

87-
RUNTIME_CHECKS: dict[str, list[tuple[str, Callable[[], None]]]] = {
88-
'base': [
89-
(base_send_message.NAME, base_send_message.check),
90-
],
79+
# Imported lazily in `main()` so a check that needs one profile's
80+
# extras can't break the harness when running a different profile.
81+
RUNTIME_CHECKS: dict[str, list[str]] = {
82+
'base': ['tests.install_smoke.runtime.base_send_message'],
9183
}
9284

9385

@@ -124,14 +116,17 @@ def main(argv: list[str]) -> int:
124116

125117
print(f'\nRunning {len(runtime_checks)} runtime check(s):')
126118
runtime_failures: list[str] = []
127-
for name, check in runtime_checks:
119+
for module_path in runtime_checks:
120+
label = module_path
128121
try:
129-
check()
122+
module = importlib.import_module(module_path)
123+
label = module.NAME
124+
module.check()
130125
except Exception as e: # noqa: BLE001, PERF203
131-
runtime_failures.append(f'{name}: {type(e).__name__}: {e}')
132-
print(f' - FAIL: {name}')
126+
runtime_failures.append(f'{label}: {type(e).__name__}: {e}')
127+
print(f' - FAIL: {label}')
133128
else:
134-
print(f' - OK: {name}')
129+
print(f' - OK: {label}')
135130

136131
if runtime_failures:
137132
print('\nFAILED runtime checks:')

tests/install_smoke/runtime/base_send_message.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212

1313
from a2a.helpers.proto_helpers import new_task_from_user_message
1414
from a2a.server.agent_execution import AgentExecutor
15+
from a2a.server.agent_execution.context import RequestContext
1516
from a2a.server.context import ServerCallContext
17+
from a2a.server.events.event_queue import EventQueue
1618
from a2a.server.request_handlers import DefaultRequestHandler
1719
from a2a.server.tasks import InMemoryTaskStore
1820
from a2a.server.tasks.task_updater import TaskUpdater
@@ -32,7 +34,9 @@
3234

3335

3436
class _HelloAgentExecutor(AgentExecutor):
35-
async def execute(self, context, event_queue) -> None: # type: ignore[no-untyped-def]
37+
async def execute(
38+
self, context: RequestContext, event_queue: EventQueue
39+
) -> None:
3640
task = context.current_task
3741
if not task:
3842
assert context.message is not None
@@ -48,7 +52,9 @@ async def execute(self, context, event_queue) -> None: # type: ignore[no-untype
4852
)
4953
await updater.complete()
5054

51-
async def cancel(self, context, event_queue) -> None: # type: ignore[no-untyped-def]
55+
async def cancel(
56+
self, context: RequestContext, event_queue: EventQueue
57+
) -> None:
5258
pass
5359

5460

0 commit comments

Comments
 (0)