summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2021-05-06 14:10:52 (GMT)
committerGitHub <noreply@github.com>2021-05-06 14:10:52 (GMT)
commit698e9a8211c46ed5dc93e5cd7026ea05dec2f373 (patch)
treee29b8550b52183a513e3ce536cd1ee13481f3a80 /Lib/test
parent985ac016373403e8ad41f8d563c4355ffa8d49ff (diff)
downloadcpython-698e9a8211c46ed5dc93e5cd7026ea05dec2f373.zip
cpython-698e9a8211c46ed5dc93e5cd7026ea05dec2f373.tar.gz
cpython-698e9a8211c46ed5dc93e5cd7026ea05dec2f373.tar.bz2
bpo-44017: Update test_contextlib_async not to emit DeprecationWarn (GH-25918)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_contextlib_async.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_contextlib_async.py b/Lib/test/test_contextlib_async.py
index 290ef05..cbc82df 100644
--- a/Lib/test/test_contextlib_async.py
+++ b/Lib/test/test_contextlib_async.py
@@ -369,16 +369,14 @@ class TestAsyncExitStack(TestBaseExitStack, unittest.TestCase):
class SyncAsyncExitStack(AsyncExitStack):
@staticmethod
def run_coroutine(coro):
- loop = asyncio.get_event_loop()
-
- f = asyncio.ensure_future(coro)
- f.add_done_callback(lambda f: loop.stop())
+ loop = asyncio.get_event_loop_policy().get_event_loop()
+ t = loop.create_task(coro)
+ t.add_done_callback(lambda f: loop.stop())
loop.run_forever()
- exc = f.exception()
-
+ exc = t.exception()
if not exc:
- return f.result()
+ return t.result()
else:
context = exc.__context__