mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Drop Python 3.4 and switch to async / await syntax for asyncio. Fixes #1425
This commit is contained in:
1 parent
8baa480b79
commit
76af98404a
119 files changed
+2432
-3084
No files matched your search
@@ -341,10 +341,10 @@ def test_stop_capture(http_controller, tmpdir, project, compute, async_run):
|
||||
|
||||
|
||||
def test_pcap(http_controller, tmpdir, project, compute, loop):
|
||||
@asyncio.coroutine
|
||||
def go(future):
|
||||
response = yield from aiohttp.request("GET", http_controller.get_url("/projects/{}/links/{}/pcap".format(project.id, link.id)))
|
||||
response.body = yield from response.content.read(5)
|
||||
|
||||
async def go(future):
|
||||
response = await aiohttp.request("GET", http_controller.get_url("/projects/{}/links/{}/pcap".format(project.id, link.id)))
|
||||
response.body = await response.content.read(5)
|
||||
response.close()
|
||||
future.set_result(response)
|
||||
|
||||
|
||||
@@ -169,13 +169,13 @@ def test_load_project(http_controller, project, config):
|
||||
|
||||
|
||||
def test_notification(http_controller, project, controller, loop, async_run):
|
||||
@asyncio.coroutine
|
||||
def go():
|
||||
|
||||
async def go():
|
||||
connector = aiohttp.TCPConnector()
|
||||
response = yield from aiohttp.request("GET", http_controller.get_url("/projects/{project_id}/notifications".format(project_id=project.id)), connector=connector)
|
||||
response.body = yield from response.content.read(200)
|
||||
response = await aiohttp.request("GET", http_controller.get_url("/projects/{project_id}/notifications".format(project_id=project.id)), connector=connector)
|
||||
response.body = await response.content.read(200)
|
||||
controller.notification.project_emit("node.created", {"a": "b"})
|
||||
response.body += yield from response.content.readany()
|
||||
response.body += await response.content.readany()
|
||||
response.close()
|
||||
return response
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ def web_server():
|
||||
|
||||
|
||||
def test_shutdown_local(http_controller, web_server, config):
|
||||
@asyncio.coroutine
|
||||
def hello():
|
||||
|
||||
async def hello():
|
||||
return 0
|
||||
|
||||
web_server.shutdown_server.return_value = hello()
|
||||
|
||||
Reference in new issue
Block a user