Skip to content

Commit e7042d7

Browse files
Reflexcursoragent
andcommitted
chore: mark Registry test helpers; fix pyright on pool cleanup
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e6ef85a commit e7042d7

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/runloop_api_client/_base_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,14 @@ def acquire(self, shard: int) -> _SharedTransport:
161161
return transport
162162

163163
def take_all(self) -> list[_SharedTransport]:
164-
"""Remove and return all transports (test cleanup)."""
164+
"""Test-only: remove and return all transports for fixture cleanup."""
165165
with _pool_lock:
166166
values = list(self._shards.values())
167167
self._shards.clear()
168168
return values
169169

170170
def shard_ids(self) -> set[int]:
171+
"""Test-only: which shard indexes currently hold a shared transport."""
171172
with _pool_lock:
172173
return set(self._shards)
173174

@@ -229,6 +230,7 @@ def acquire(self, loop: asyncio.AbstractEventLoop, shard: int) -> _SharedAsyncTr
229230
return transport
230231

231232
def clear(self) -> None:
233+
"""Test-only: drop all per-loop shard maps (does not close transports)."""
232234
with _pool_lock:
233235
self._by_loop.clear()
234236

tests/test_h2_bulkhead_integration.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
def _clear_pool_state() -> None:
39-
old = []
39+
old: list[_base_mod._SharedTransport] = []
4040
old.extend(_base_mod._shared_sync_api_transports.take_all())
4141
old.extend(_base_mod._shared_sync_background_transports.take_all())
4242
old.extend(_base_mod._shared_sync_transfer_transports.take_all())
@@ -49,6 +49,7 @@ def _clear_pool_state() -> None:
4949
except Exception:
5050
pass
5151

52+
5253
@pytest.fixture(autouse=True)
5354
def _reset_pools() -> Iterator[None]: # pyright: ignore[reportUnusedFunction]
5455
_clear_pool_state()

tests/test_shared_pool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _reset_shared_pool() -> Iterator[None]: # pyright: ignore[reportUnusedFunct
2828

2929

3030
def _clear_pool_state() -> None:
31-
old = []
31+
old: list[_base_mod._SharedTransport] = []
3232
old.extend(_base_mod._shared_sync_api_transports.take_all())
3333
old.extend(_base_mod._shared_sync_background_transports.take_all())
3434
old.extend(_base_mod._shared_sync_transfer_transports.take_all())
@@ -41,6 +41,7 @@ def _clear_pool_state() -> None:
4141
except Exception:
4242
pass
4343

44+
4445
def _make_client(**kwargs: Any) -> Runloop:
4546
kwargs.setdefault("base_url", base_url)
4647
kwargs.setdefault("bearer_token", bearer_token)

tests/test_transfer_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _reset_shared_pool() -> Iterator[None]: # pyright: ignore[reportUnusedFunct
4242

4343

4444
def _clear_pool_state() -> None:
45-
old = []
45+
old: list[_base_mod._SharedTransport] = []
4646
old.extend(_base_mod._shared_sync_api_transports.take_all())
4747
old.extend(_base_mod._shared_sync_background_transports.take_all())
4848
old.extend(_base_mod._shared_sync_transfer_transports.take_all())

0 commit comments

Comments
 (0)