Skip to content

Commit 230041f

Browse files
vvillait88claude
andcommitted
test: fix event-loop error in capture_wallet no-op test
asyncio.get_event_loop() raises RuntimeError on Python 3.12+ when no loop is running. Convert the test to async def (asyncio_mode=auto) and await capture_wallet directly, matching the other async tests in the file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 80fe070 commit 230041f

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

‎tests/test_middleware.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def test_no_ops_when_wallet_authenticated(self):
299299
assert capture_route.call_count == 0
300300

301301
@respx.mock
302-
def test_no_ops_when_gate_did_not_run(self):
302+
async def test_no_ops_when_gate_did_not_run(self):
303303
"""Calling capture_wallet on a request that never went through AgentScoreGate
304304
(no middleware installed) should silently no-op rather than crash."""
305305
import httpx as httpx_client # avoid shadowing the module-level import
@@ -319,11 +319,7 @@ async def _receive() -> dict:
319319

320320
request = SReq(scope, _receive)
321321

322-
import asyncio
323-
324-
asyncio.get_event_loop().run_until_complete(
325-
capture_wallet(request, "0xsigner", "evm"),
326-
)
322+
await capture_wallet(request, "0xsigner", "evm")
327323
assert capture_route.call_count == 0
328324

329325

0 commit comments

Comments
 (0)