We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8dff511 commit 2c6c3e7Copy full SHA for 2c6c3e7
1 file changed
src/trio/_tests/test_sync.py
@@ -237,8 +237,25 @@ async def test_CapacityLimiter_zero_limit_tokens() -> None:
237
c.total_tokens = 1
238
assert c.statistics().tasks_waiting == 0
239
assert c.statistics().borrowers == [6]
240
-
241
c.release_on_behalf_of(6)
+
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
259
c.total_tokens = 0
260
261
nursery.cancel_scope.cancel()
0 commit comments