summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/async_case.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2019-09-11 08:20:24 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-11 08:20:24 (GMT)
commit7264e92b718d307cc499b2f10eab7644b00f0499 (patch)
tree7c1d18de546bd8373eeb899b8cf3824874a30dfc /Lib/unittest/async_case.py
parentefd5741ae953e50a6654e04cf731da86a1307296 (diff)
downloadcpython-7264e92b718d307cc499b2f10eab7644b00f0499.zip
cpython-7264e92b718d307cc499b2f10eab7644b00f0499.tar.gz
cpython-7264e92b718d307cc499b2f10eab7644b00f0499.tar.bz2
bpo-36373: Fix deprecation warnings (GH-15889)
https://bugs.python.org/issue36373
Diffstat (limited to 'Lib/unittest/async_case.py')
-rw-r--r--Lib/unittest/async_case.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/unittest/async_case.py b/Lib/unittest/async_case.py
index a3c8bfb..1bc1312 100644
--- a/Lib/unittest/async_case.py
+++ b/Lib/unittest/async_case.py
@@ -89,8 +89,9 @@ class IsolatedAsyncioTestCase(TestCase):
else:
return ret
- async def _asyncioLoopRunner(self):
- queue = self._asyncioCallsQueue
+ async def _asyncioLoopRunner(self, fut):
+ self._asyncioCallsQueue = queue = asyncio.Queue()
+ fut.set_result(None)
while True:
query = await queue.get()
queue.task_done()
@@ -113,8 +114,9 @@ class IsolatedAsyncioTestCase(TestCase):
asyncio.set_event_loop(loop)
loop.set_debug(True)
self._asyncioTestLoop = loop
- self._asyncioCallsQueue = asyncio.Queue(loop=loop)
- self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner())
+ fut = loop.create_future()
+ self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner(fut))
+ loop.run_until_complete(fut)
def _tearDownAsyncioLoop(self):
assert self._asyncioTestLoop is not None