mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-36373: Deprecate explicit loop parameter in all public asyncio APIs [locks] (GH-13920)
This PR deprecate explicit loop parameters in all public asyncio APIs This issues is split to be easier to review. Third step: locks.py https://bugs.python.org/issue36373
This commit is contained in:
parent
9669931e5e
commit
537877d85d
7 changed files with 419 additions and 265 deletions
|
|
@ -43,12 +43,13 @@ class BaseTest(test_utils.TestCase):
|
|||
class LockTests(BaseTest):
|
||||
|
||||
def test_context_manager_async_with(self):
|
||||
primitives = [
|
||||
asyncio.Lock(loop=self.loop),
|
||||
asyncio.Condition(loop=self.loop),
|
||||
asyncio.Semaphore(loop=self.loop),
|
||||
asyncio.BoundedSemaphore(loop=self.loop),
|
||||
]
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
primitives = [
|
||||
asyncio.Lock(loop=self.loop),
|
||||
asyncio.Condition(loop=self.loop),
|
||||
asyncio.Semaphore(loop=self.loop),
|
||||
asyncio.BoundedSemaphore(loop=self.loop),
|
||||
]
|
||||
|
||||
async def test(lock):
|
||||
await asyncio.sleep(0.01)
|
||||
|
|
@ -65,12 +66,13 @@ class LockTests(BaseTest):
|
|||
self.assertFalse(primitive.locked())
|
||||
|
||||
def test_context_manager_with_await(self):
|
||||
primitives = [
|
||||
asyncio.Lock(loop=self.loop),
|
||||
asyncio.Condition(loop=self.loop),
|
||||
asyncio.Semaphore(loop=self.loop),
|
||||
asyncio.BoundedSemaphore(loop=self.loop),
|
||||
]
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
primitives = [
|
||||
asyncio.Lock(loop=self.loop),
|
||||
asyncio.Condition(loop=self.loop),
|
||||
asyncio.Semaphore(loop=self.loop),
|
||||
asyncio.BoundedSemaphore(loop=self.loop),
|
||||
]
|
||||
|
||||
async def test(lock):
|
||||
await asyncio.sleep(0.01)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue