Skip to content

Commit b529018

Browse files
mishushakovclaude
andcommitted
Make async_sandbox_factory teardown exception-safe
Use asyncio.gather(..., return_exceptions=True) so a failure killing one sandbox doesn't skip cleanup of the others, matching the independence the previous per-finalizer approach provided. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 2d12421 commit b529018

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

python/tests/conftest.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import os
23

34
import pytest
@@ -58,8 +59,9 @@ async def factory(*, template_name: str = template, **kwargs):
5859

5960
yield factory
6061

61-
for sandbox in sandboxes:
62-
await sandbox.kill()
62+
await asyncio.gather(
63+
*(sandbox.kill() for sandbox in sandboxes), return_exceptions=True
64+
)
6365

6466

6567
@pytest.fixture

0 commit comments

Comments
 (0)