File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,33 @@ async def c(event: EventInput, global_ctx):
85
85
print (result )
86
86
87
87
88
+ @pytest .mark .asyncio
89
+ async def test_multi_recv_cancel ():
90
+ @default_drive .make_event
91
+ async def start (event : EventInput , global_ctx ):
92
+ return None
93
+
94
+ @default_drive .listen_group ([start ])
95
+ async def a (event : EventInput , global_ctx ):
96
+ raise asyncio .CancelledError ()
97
+ return 1
98
+
99
+ @default_drive .listen_group ([start ])
100
+ async def b (event : EventInput , global_ctx ):
101
+ await asyncio .sleep (0.2 )
102
+ return 2
103
+
104
+ @default_drive .listen_group ([a , b ])
105
+ async def c (event : EventInput , global_ctx ):
106
+ assert event .group_name == "0"
107
+ assert event .behavior == ReturnBehavior .DISPATCH
108
+ assert event .results == {a .id : 1 , b .id : 2 }
109
+ return 3
110
+
111
+ with pytest .raises (asyncio .CancelledError ):
112
+ result = await default_drive .invoke_event (start , None , {"test_ctx" : 1 })
113
+
114
+
88
115
@pytest .mark .asyncio
89
116
async def test_multi_groups ():
90
117
@default_drive .make_event
You can’t perform that action at this time.
0 commit comments