File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -237,8 +237,25 @@ async def test_CapacityLimiter_zero_limit_tokens() -> None:
237
237
c .total_tokens = 1
238
238
assert c .statistics ().tasks_waiting == 0
239
239
assert c .statistics ().borrowers == [6 ]
240
-
241
240
c .release_on_behalf_of (6 )
241
+
242
+ await c .acquire_on_behalf_of (0 ) # total_tokens is 1
243
+
244
+ nursery .start_soon (c .acquire_on_behalf_of , 1 )
245
+ c .total_tokens = 0
246
+
247
+ assert c .statistics ().borrowers == [0 ]
248
+
249
+ c .release_on_behalf_of (0 )
250
+ assert c .statistics ().borrowers == []
251
+ assert c .statistics ().tasks_waiting == 0
252
+
253
+ c .total_tokens = 1
254
+ await wait_all_tasks_blocked ()
255
+ assert c .statistics ().borrowers == [1 ]
256
+
257
+ c .release_on_behalf_of (1 )
258
+
242
259
c .total_tokens = 0
243
260
244
261
nursery .cancel_scope .cancel ()
You can’t perform that action at this time.
0 commit comments