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
(cherry picked from commit 537877d85d)

Co-authored-by: Emmanuel Arias <emmanuelarias30@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-09-10 04:26:54 -07:00 committed by GitHub
parent ab74e52f76
commit bb8fc8bd30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 419 additions and 265 deletions

View file

@ -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)