@@ -111,7 +111,7 @@ def done_callback(outcome: Outcome[T]) -> None:
111111
112112def test_guest_trivial () -> None :
113113 async def trio_return (in_host : InHost ) -> str :
114- await trio .sleep ( 0 )
114+ await trio .lowlevel . checkpoint ( )
115115 return "ok"
116116
117117 assert trivial_guest_run (trio_return ) == "ok"
@@ -149,7 +149,7 @@ def test_guest_is_initialized_when_start_returns() -> None:
149149
150150 async def trio_main (in_host : InHost ) -> str :
151151 record .append ("main task ran" )
152- await trio .sleep ( 0 )
152+ await trio .lowlevel . checkpoint ( )
153153 assert trio .lowlevel .current_trio_token () is trio_token
154154 return "ok"
155155
@@ -164,7 +164,7 @@ def after_start() -> None:
164164 @trio .lowlevel .spawn_system_task
165165 async def early_task () -> None :
166166 record .append ("system task ran" )
167- await trio .sleep ( 0 )
167+ await trio .lowlevel . checkpoint ( )
168168
169169 res = trivial_guest_run (trio_main , in_host_after_start = after_start )
170170 assert res == "ok"
@@ -396,7 +396,7 @@ def do_abandoned_guest_run() -> None:
396396 async def abandoned_main (in_host : InHost ) -> None :
397397 in_host (lambda : 1 / 0 )
398398 while True :
399- await trio .sleep ( 0 )
399+ await trio .lowlevel . checkpoint ( )
400400
401401 with pytest .raises (ZeroDivisionError ):
402402 trivial_guest_run (abandoned_main )
@@ -472,7 +472,7 @@ async def trio_main() -> str:
472472
473473 # Make sure we have at least one tick where we don't need to go into
474474 # the thread
475- await trio .sleep ( 0 )
475+ await trio .lowlevel . checkpoint ( )
476476
477477 from_trio .put_nowait (0 )
478478
@@ -540,7 +540,7 @@ async def crash_in_run_loop(in_host: InHost) -> None:
540540
541541 async def crash_in_io (in_host : InHost ) -> None :
542542 m .setattr ("trio._core._run.TheIOManager.get_events" , None )
543- await trio .sleep ( 0 )
543+ await trio .lowlevel . checkpoint ( )
544544
545545 with pytest .raises (trio .TrioInternalError ):
546546 trivial_guest_run (crash_in_io )
0 commit comments