MCPcopy Index your code
hub / github.com/python/cpython / test_acquire_hang

Method test_acquire_hang

Lib/test/test_asyncio/test_locks.py:1051–1063  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1049 await asyncio.sleep(0)
1050
1051 async def test_acquire_hang(self):
1052 sem = asyncio.Semaphore(value=0)
1053
1054 t1 = asyncio.create_task(sem.acquire())
1055 t2 = asyncio.create_task(sem.acquire())
1056 await asyncio.sleep(0)
1057
1058 t1.cancel()
1059 sem.release()
1060 await asyncio.sleep(0)
1061 await asyncio.sleep(0)
1062 self.assertTrue(sem.locked())
1063 self.assertTrue(t2.done())
1064
1065 async def test_acquire_no_hang(self):
1066

Callers

nothing calls this directly

Calls 9

acquireMethod · 0.95
releaseMethod · 0.95
lockedMethod · 0.95
SemaphoreMethod · 0.80
assertTrueMethod · 0.80
create_taskMethod · 0.45
sleepMethod · 0.45
cancelMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected