mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Replace asyncio.async() by asyncio.ensure_future() in tests. Ref #2566.
This commit is contained in:
1 parent
089d25c79d
commit
a3d1e865a8
19 files changed
+171
-171
No files matched your search
@@ -74,7 +74,7 @@ class Query:
|
||||
response = yield from self._session.ws_connect(self.get_url(path))
|
||||
future.set_result(response)
|
||||
future = asyncio.Future()
|
||||
asyncio.async(go_request(future))
|
||||
asyncio.ensure_future(go_request(future))
|
||||
self._loop.run_until_complete(future)
|
||||
return future.result()
|
||||
|
||||
@@ -85,7 +85,7 @@ class Query:
|
||||
- example if True the session is included inside documentation
|
||||
- raw do not JSON encode the query
|
||||
"""
|
||||
return self._loop.run_until_complete(asyncio.async(self._async_fetch(method, path, body=body, **kwargs)))
|
||||
return self._loop.run_until_complete(asyncio.ensure_future(self._async_fetch(method, path, body=body, **kwargs)))
|
||||
|
||||
@asyncio.coroutine
|
||||
def _async_fetch(self, method, path, body=None, **kwargs):
|
||||
|
||||
@@ -356,7 +356,7 @@ def test_pcap(http_controller, tmpdir, project, compute, loop):
|
||||
project._links = {link.id: link}
|
||||
|
||||
future = asyncio.Future()
|
||||
asyncio.async(go(future))
|
||||
asyncio.ensure_future(go(future))
|
||||
response = loop.run_until_complete(future)
|
||||
assert response.status == 200
|
||||
assert b'hello' == response.body
|
||||
|
||||
@@ -179,7 +179,7 @@ def test_notification(http_controller, project, controller, loop, async_run):
|
||||
response.close()
|
||||
return response
|
||||
|
||||
response = async_run(asyncio.async(go()))
|
||||
response = async_run(asyncio.ensure_future(go()))
|
||||
assert response.status == 200
|
||||
assert b'"action": "ping"' in response.body
|
||||
assert b'"cpu_usage_percent"' in response.body
|
||||
|
||||
Reference in new issue
Block a user