File tree 1 file changed +7
-3
lines changed
src/py/reactpy/tests/test_core
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():
594
594
async def effect_func (e ):
595
595
async with e :
596
596
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 )
599
602
did_cleanup .current = True
600
603
601
604
async def main ():
@@ -604,7 +607,8 @@ async def main():
604
607
await effect .stop ()
605
608
606
609
with pytest .raises (asyncio .CancelledError ):
607
- await main ()
610
+ outer_task = asyncio .create_task (main ())
611
+ await outer_task
608
612
609
613
assert not did_cleanup .current
610
614
You can’t perform that action at this time.
0 commit comments