|
82 | 82 | @pytest.mark.parametrize(("name", "wire_method", "params", "response"), REQUESTS) |
83 | 83 | async def test_agent_request_roundtrip(connect, agent, name, wire_method, params, response): |
84 | 84 | handler = AsyncMock(return_value=response) |
85 | | - setattr(agent, name, handler) |
| 85 | + |
| 86 | + # Python 3.10 cannot inspect the signature of a bare AsyncMock. |
| 87 | + async def handle(**kwargs): |
| 88 | + return await handler(**kwargs) |
| 89 | + |
| 90 | + setattr(agent, name, handle) |
86 | 91 | _, connection = connect(use_unstable_protocol=True) |
87 | 92 | result = await getattr(connection, name)(**params, trace="test") |
88 | 93 | assert result == response |
@@ -204,7 +209,12 @@ def test_all_schema_methods_have_routes_and_senders(builder, methods, connection |
204 | 209 | ) |
205 | 210 | async def test_stable_methods_work_without_unstable_flag(connect, agent, name, params, response): |
206 | 211 | handler = AsyncMock(return_value=response) |
207 | | - setattr(agent, name, handler) |
| 212 | + |
| 213 | + # Python 3.10 cannot inspect the signature of a bare AsyncMock. |
| 214 | + async def handle(**kwargs): |
| 215 | + return await handler(**kwargs) |
| 216 | + |
| 217 | + setattr(agent, name, handle) |
208 | 218 | _, connection = connect() |
209 | 219 | assert await getattr(connection, name)(**params) == response |
210 | 220 | handler.assert_awaited_once_with(**params) |
0 commit comments