Skip to content

Commit 1cfe029

Browse files
author
Roman
committed
apply asyncio run to async substrate.close() call
1 parent c01f874 commit 1cfe029

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/e2e_tests/conftest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import logging
23
import os
34
import re
@@ -184,9 +185,16 @@ def try_start_docker():
184185
)
185186
if not result.stdout.strip():
186187
raise RuntimeError("Docker container failed to start.")
187-
yield AsyncSubstrateInterface(url="ws://127.0.0.1:9944")
188+
substrate = AsyncSubstrateInterface(url="ws://127.0.0.1:9944")
189+
yield substrate
188190

189191
finally:
192+
try:
193+
if substrate:
194+
asyncio.run(substrate.close())
195+
except Exception:
196+
logging.warning("Failed to close substrate connection.")
197+
190198
try:
191199
subprocess.run(["docker", "kill", container_name])
192200
process.wait(timeout=10)

0 commit comments

Comments
 (0)