@@ -26,7 +26,7 @@ async def via_create_task():
2626 await asyncio .Future ()
2727 raise RuntimeError ("Unreachable" )
2828 except asyncio .CancelledError :
29- activity .heartbeat ("cancelled" )
29+ activity .heartbeat (f "cancelled= { activity . cancellation_details (). cancel_requested } " , )
3030 return "done"
3131
3232 env = ActivityEnvironment ()
@@ -37,9 +37,9 @@ async def via_create_task():
3737 task = asyncio .create_task (env .run (do_stuff , "param1" ))
3838 await waiting .wait ()
3939 # Cancel and confirm done
40- env .cancel ()
40+ env .cancel (cancellation_details = activity . ActivityCancellationDetails ( cancel_requested = True ) )
4141 assert "done" == await task
42- assert heartbeats == ["param: param1" , "task, type: unknown" , "cancelled" ]
42+ assert heartbeats == ["param: param1" , "task, type: unknown" , "cancelled=True " ]
4343
4444
4545def test_activity_env_sync ():
@@ -72,7 +72,7 @@ def via_thread():
7272 raise RuntimeError ("Unexpected" )
7373 except CancelledError :
7474 nonlocal properly_cancelled
75- properly_cancelled = True
75+ properly_cancelled = activity . cancellation_details (). cancel_requested
7676
7777 env = ActivityEnvironment ()
7878 # Set heartbeat handler to add to list
@@ -84,7 +84,7 @@ def via_thread():
8484 waiting .wait ()
8585 # Cancel and confirm done
8686 time .sleep (1 )
87- env .cancel ()
87+ env .cancel (cancellation_details = activity . ActivityCancellationDetails ( cancel_requested = True ) )
8888 thread .join ()
8989 assert heartbeats == ["param: param1" , "task, type: unknown" ]
9090 assert properly_cancelled
0 commit comments