asyncio: PendingDeprecationWarning -> DeprecationWarning by methane · Pull Request #12494 · python/cpython (original) (raw)

Expand Up

@@ -1634,26 +1634,26 @@ def coro():

def test_current_task_deprecated(self):

Task = self.__class__.Task

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertIsNone(Task.current_task(loop=self.loop))

async def coro(loop):

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertIs(Task.current_task(loop=loop), task)

# See http://bugs.python.org/issue29271 for details:

asyncio.set_event_loop(loop)

try:

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertIs(Task.current_task(None), task)

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertIs(Task.current_task(), task)

finally:

asyncio.set_event_loop(None)

task = self.new_task(self.loop, coro(self.loop))

self.loop.run_until_complete(task)

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertIsNone(Task.current_task(loop=self.loop))

def test_current_task(self):

Expand Down Expand Up

@@ -1982,7 +1982,7 @@ def test_all_tasks_deprecated(self):

Task = self.__class__.Task

async def coro():

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

assert Task.all_tasks(self.loop) == {t}

t = self.new_task(self.loop, coro())

Expand Down Expand Up

@@ -2012,9 +2012,9 @@ def kill_me(loop):

# See http://bugs.python.org/issue29271 for details:

asyncio.set_event_loop(self.loop)

try:

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertEqual(Task.all_tasks(), {task})

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertEqual(Task.all_tasks(None), {task})

finally:

asyncio.set_event_loop(None)

Expand Down Expand Up

@@ -2692,7 +2692,7 @@ def done(self):

self.assertEqual(asyncio.all_tasks(loop), set())

self._register_task(task)

self.assertEqual(asyncio.all_tasks(loop), set())

with self.assertWarns(PendingDeprecationWarning):

with self.assertWarns(DeprecationWarning):

self.assertEqual(asyncio.Task.all_tasks(loop), {task})

self._unregister_task(task)

Expand Down