Skip to content

Commit

Permalink
asyncio.run introduced some breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Oct 18, 2024
1 parent a3c1816 commit 8c4d328
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/trio/_core/_tests/test_guest_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,9 @@ def aiotrio_run(
pass_not_threadsafe: bool = True,
**start_guest_run_kwargs: Any,
) -> T:
loop = asyncio.get_running_loop()

async def aio_main() -> T:
loop = asyncio.get_running_loop()
trio_done_fut: asyncio.Future[Outcome[T]] = loop.create_future()

Check warning on line 446 in src/trio/_core/_tests/test_guest_mode.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_tests/test_guest_mode.py#L446

Added line #L446 was not covered by tests

def trio_done_callback(main_outcome: Outcome[T]) -> None:

Check warning on line 448 in src/trio/_core/_tests/test_guest_mode.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_tests/test_guest_mode.py#L448

Added line #L448 was not covered by tests
Expand All @@ -460,7 +461,12 @@ def trio_done_callback(main_outcome: Outcome[T]) -> None:

return (await trio_done_fut).unwrap()

Check warning on line 462 in src/trio/_core/_tests/test_guest_mode.py

View check run for this annotation

Codecov / codecov/patch

src/trio/_core/_tests/test_guest_mode.py#L462

Added line #L462 was not covered by tests

return asyncio.run(aio_main())
try:
# can't use asyncio.run because that fails on Windows (3.8, x64, with
# Komodia LSP)
return loop.run_until_complete(aio_main())
finally:
loop.close()


def test_guest_mode_on_asyncio() -> None:
Expand Down

0 comments on commit 8c4d328

Please sign in to comment.