Skip to content

Commit b2bb5db

Browse files
author
Andrey Cheptsov
committed
Document asyncio isolation in offer CLI test
Add a short comment explaining why the helper uses a private event loop instead of asyncio.run(): the latter clears the current loop on Python 3.9/3.10 and can break later tests in the same worker.
1 parent 916757a commit b2bb5db

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/tests/_internal/cli/utils/test_offer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ def _get_offer(index: int) -> InstanceOfferWithAvailability:
3636

3737
def _get_run_plan(*, offers: list[InstanceOfferWithAvailability], total_offers: int) -> RunPlan:
3838
run_spec = get_run_spec(repo_id="test-repo")
39+
# Keep this helper's asyncio state isolated. `asyncio.run()` clears the current event loop
40+
# on Python 3.9/3.10, which can break later tests that still expect one to exist.
3941
loop = asyncio.new_event_loop()
4042
try:
4143
job = loop.run_until_complete(

0 commit comments

Comments
 (0)