Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
test(python-sdk): parallelize async sandbox teardown (#1309)
Mish Ushakov575339b16379
diff --git a/packages/python-sdk/tests/conftest.py b/packages/python-sdk/tests/conftest.pyindex 1d1ffaef6..2c5f02263 100644--- a/packages/python-sdk/tests/conftest.py+++ b/packages/python-sdk/tests/conftest.py@@ -79,13 +79,16 @@ async def async_sandbox_factory(request, template, sandbox_test_id):yield factory- for sandbox in sandboxes:- if getattr(request.node, "_test_failed", False):+ if getattr(request.node, "_test_failed", False):+ for sandbox in sandboxes:print(f"\n[TEST FAILED] Sandbox ID: {sandbox.sandbox_id}")- try:- await sandbox.kill()- except Exception:- pass++ results = await asyncio.gather(+ *(sandbox.kill() for sandbox in sandboxes), return_exceptions=True+ )+ for sandbox, result in zip(sandboxes, results):+ if isinstance(result, BaseException):+ print(f"\n[TEARDOWN FAILED] Sandbox ID: {sandbox.sandbox_id}: {result!r}")@pytest_asyncio.fixture