mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01: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
@@ -39,8 +39,7 @@ def test_query_success(loop, vm):
|
||||
response.status = 200
|
||||
response.headers = {'CONTENT-TYPE': 'application/json'}
|
||||
|
||||
@asyncio.coroutine
|
||||
def read():
|
||||
async def read():
|
||||
return b'{"c": false}'
|
||||
|
||||
response.read.side_effect = read
|
||||
@@ -61,8 +60,7 @@ def test_query_error(loop, vm):
|
||||
response = MagicMock()
|
||||
response.status = 404
|
||||
|
||||
@asyncio.coroutine
|
||||
def read():
|
||||
async def read():
|
||||
return b"NOT FOUND"
|
||||
|
||||
response.read.side_effect = read
|
||||
@@ -82,8 +80,7 @@ def test_query_error_json(loop, vm):
|
||||
response = MagicMock()
|
||||
response.status = 404
|
||||
|
||||
@asyncio.coroutine
|
||||
def read():
|
||||
async def read():
|
||||
return b'{"message": "Error"}'
|
||||
|
||||
response.read.side_effect = read
|
||||
@@ -145,8 +142,7 @@ def test_pull_image(loop):
|
||||
def __init__(self):
|
||||
self._read = -1
|
||||
|
||||
@asyncio.coroutine
|
||||
def read(self, size):
|
||||
async def read(self, size):
|
||||
self._read += 1
|
||||
if self._read == 0:
|
||||
return b'{"progress": "0/100",'
|
||||
|
||||
@@ -366,8 +366,7 @@ def test_create_image_not_available(loop, project, manager):
|
||||
|
||||
call = 0
|
||||
|
||||
@asyncio.coroutine
|
||||
def information():
|
||||
async def information():
|
||||
nonlocal call
|
||||
if call == 0:
|
||||
call += 1
|
||||
@@ -927,8 +926,8 @@ def test_stop_capture(vm, tmpdir, manager, free_console_port, loop):
|
||||
|
||||
|
||||
def test_get_log(loop, vm):
|
||||
@asyncio.coroutine
|
||||
def read():
|
||||
|
||||
async def read():
|
||||
return b'Hello\nWorld'
|
||||
|
||||
mock_query = MagicMock()
|
||||
@@ -1036,8 +1035,7 @@ def test_read_console_output_with_binary_mode(vm, loop):
|
||||
def __init__(self):
|
||||
self.sent = False
|
||||
|
||||
@asyncio.coroutine
|
||||
def receive(self):
|
||||
async def receive(self):
|
||||
if not self.sent:
|
||||
self.sent = True
|
||||
return MagicMock(tp=aiohttp.WSMsgType.BINARY, data=b"test")
|
||||
|
||||
@@ -79,8 +79,7 @@ def test_list_vms(manager, loop):
|
||||
'"<inaccessible>" {42b4d095-ff5f-4ac4-bb9d-5f2c7861c1f1}',
|
||||
'"Linux Microcore 4.7.1" {ccd8c50b-c172-457d-99fa-dd69371ede0e}']
|
||||
|
||||
@asyncio.coroutine
|
||||
def execute_mock(cmd, args):
|
||||
async def execute_mock(cmd, args):
|
||||
if cmd == "list":
|
||||
return vm_list
|
||||
else:
|
||||
|
||||
Reference in new issue
Block a user