Skip to content

Commit a3c1816

Browse files
committed
move sniffio import to top
1 parent 1eae0c5 commit a3c1816

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/trio/_core/_tests/test_guest_mode.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
)
2525

2626
import pytest
27+
import sniffio
2728
from outcome import Outcome
2829

2930
import trio
@@ -223,7 +224,8 @@ async def trio_main(in_host: InHost) -> str:
223224

224225

225226
def test_guest_mode_sniffio_integration() -> None:
226-
from sniffio import current_async_library, thread_local as sniffio_library
227+
current_async_library = sniffio.current_async_library
228+
sniffio_library = sniffio.thread_local
227229

228230
async def trio_main(in_host: InHost) -> str:
229231
async def synchronize() -> None:
@@ -626,8 +628,6 @@ async def trio_main(in_host: InHost) -> None:
626628

627629
@restore_unraisablehook()
628630
def test_guest_mode_asyncgens() -> None:
629-
import sniffio
630-
631631
record = set()
632632

633633
async def agen(label: str) -> AsyncGenerator[int, None]:
@@ -661,8 +661,6 @@ async def trio_main() -> None:
661661

662662
@restore_unraisablehook()
663663
def test_guest_mode_asyncgens_garbage_collection() -> None:
664-
import sniffio
665-
666664
record: set[tuple[str, str, bool]] = set()
667665

668666
async def agen(label: str) -> AsyncGenerator[int, None]:

0 commit comments

Comments
 (0)