|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | import asyncio |
| 6 | +import warnings |
6 | 7 |
|
7 | 8 | from arcp import ClientInfo, RuntimeInfo, pair_memory_transports |
8 | 9 | from arcp.client import ARCPClient |
@@ -70,3 +71,32 @@ async def echo(input_value, ctx: JobContext): |
70 | 71 | await client.close() |
71 | 72 | await rt.close() |
72 | 73 | server.cancel() |
| 74 | + |
| 75 | + |
| 76 | +async def test_submit_does_not_emit_deprecation_warning() -> None: |
| 77 | + rt = ARCPRuntime( |
| 78 | + runtime=RuntimeInfo(name="r", version="1"), |
| 79 | + bearer=StaticBearerVerifier({"tok": "p1"}), |
| 80 | + heartbeat_interval_sec=60.0, |
| 81 | + ) |
| 82 | + |
| 83 | + async def echo(input_value, ctx: JobContext): |
| 84 | + return input_value |
| 85 | + |
| 86 | + rt.register_agent("echo", echo) |
| 87 | + |
| 88 | + a, b = pair_memory_transports() |
| 89 | + server = asyncio.create_task(rt.accept(a)) |
| 90 | + client = ARCPClient(client=ClientInfo(name="c", version="1"), token="tok") |
| 91 | + try: |
| 92 | + with warnings.catch_warnings(): |
| 93 | + warnings.simplefilter("error", DeprecationWarning) |
| 94 | + await client.connect(b) |
| 95 | + handle = await client.submit(agent="echo", input={"x": 1}) |
| 96 | + result = await handle.done |
| 97 | + assert result.final_status == "success" |
| 98 | + assert result.result == {"x": 1} |
| 99 | + finally: |
| 100 | + await client.close() |
| 101 | + await rt.close() |
| 102 | + server.cancel() |
0 commit comments