Skip to content

Commit 042b761

Browse files
committed
Silence warnings on async iterator by properly disconnecting
1 parent 05958bb commit 042b761

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/integration/go_ethereum/test_goethereum_ws/test_async_iterator_w3.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ async def async_w3(start_geth_process_and_yield_port):
2727
endpoint_uri = f"ws://127.0.0.1:{port}"
2828
# async iterator pattern
2929
async for w3 in AsyncWeb3(WebSocketProvider(endpoint_uri, request_timeout=10)):
30-
return w3
30+
yield w3
31+
# we won't be iterating to the next w3 instance, so disconnect explicitly
32+
await w3.provider.disconnect()
33+
break
3134

3235

3336
class TestGoEthereumAsyncWeb3ModuleTest(GoEthereumAsyncWeb3ModuleTest):

0 commit comments

Comments
 (0)