File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -818,7 +818,7 @@ def test_run_fn_as_system_task_catched_badly_typed_token():
818818 from_thread_run_sync (_core .current_time , trio_token = "Not TrioTokentype" )
819819
820820
821- async def test_from_thread_inside_trio_thread ():
821+ async def test_from_thread_inside_same_trio_thread ():
822822 def not_called (): # pragma: no cover
823823 assert False
824824
@@ -827,6 +827,15 @@ def not_called(): # pragma: no cover
827827 from_thread_run_sync (not_called , trio_token = trio_token )
828828
829829
830+ async def test_from_thread_inside_different_trio_thread ():
831+ target_token = current_trio_token ()
832+
833+ async def thread_fn ():
834+ return from_thread_run_sync (current_trio_token , trio_token = target_token )
835+
836+ assert target_token == await to_thread_run_sync (_core .run , thread_fn )
837+
838+
830839@pytest .mark .skipif (buggy_pypy_asyncgens , reason = "pypy 7.2.0 is buggy" )
831840def test_from_thread_run_during_shutdown ():
832841 save = []
You can’t perform that action at this time.
0 commit comments