File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/py/reactpy/tests/test_core Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -594,8 +594,11 @@ async def test_effect_external_cancellation_is_propagated():
594594 async def effect_func (e ):
595595 async with e :
596596 did_start .set ()
597- asyncio .current_task ().cancel ()
598- await asyncio .sleep (0 ) # allow cancellation to propagate
597+ # We don't use e.task or asyncio.current_task() because there seems to
598+ # be some platform dependence on whether the task is cancelled properly
599+ outer_task .cancel ()
600+ # Allow cancellation to propagate
601+ await asyncio .sleep (0 )
599602 did_cleanup .current = True
600603
601604 async def main ():
@@ -604,7 +607,8 @@ async def main():
604607 await effect .stop ()
605608
606609 with pytest .raises (asyncio .CancelledError ):
607- await main ()
610+ outer_task = asyncio .create_task (main ())
611+ await outer_task
608612
609613 assert not did_cleanup .current
610614
You can’t perform that action at this time.
0 commit comments