Drop Python 3.4 and switch to async / await syntax for asyncio. Fixes #1425

This commit is contained in:
grossmj committed 2018-10-15 17:05:49 +07:00
1 parent 8baa480b79
commit 76af98404a
119 files changed
+2432 -3084

No files matched your search

+2 -4
View File
@@ -205,8 +205,7 @@ def test_connectNotification(compute, async_run):
call = 0
@asyncio.coroutine
def receive():
async def receive():
nonlocal call
call += 1
if call == 1:
@@ -238,8 +237,7 @@ def test_connectNotificationPing(compute, async_run):
call = 0
@asyncio.coroutine
def receive():
async def receive():
nonlocal call
call += 1
if call == 1:
+5 -5
View File
@@ -284,10 +284,10 @@ def test_json_serial_link(async_run, project, compute, link):
def test_start_streaming_pcap(link, async_run, tmpdir, project):
@asyncio.coroutine
def fake_reader():
async def fake_reader():
output = AsyncioBytesIO()
yield from output.write(b"hello")
await output.write(b"hello")
output.seek(0)
return output
@@ -314,8 +314,8 @@ def test_default_capture_file_name(project, compute, async_run):
def test_start_capture(link, async_run, tmpdir, project, controller):
@asyncio.coroutine
def fake_reader():
async def fake_reader():
return AsyncioBytesIO()
link.read_pcap_from_source = fake_reader
+1 -2
View File
@@ -211,8 +211,7 @@ def test_create_image_missing(node, compute, project, async_run):
node.__calls = 0
@asyncio.coroutine
def resp(*args, **kwargs):
async def resp(*args, **kwargs):
node.__calls += 1
response = MagicMock()
if node.__calls == 1:
+12 -24
View File
@@ -41,8 +41,7 @@ def test_create(async_run, project):
node2 = Node(project, compute2, "node2", node_type="vpcs")
node2._ports = [EthernetPort("E0", 0, 3, 1)]
@asyncio.coroutine
def subnet_callback(compute2):
async def subnet_callback(compute2):
"""
Fake subnet callback
"""
@@ -54,8 +53,7 @@ def test_create(async_run, project):
async_run(link.add_node(node1, 0, 4))
async_run(link.update_filters({"latency": [10]}))
@asyncio.coroutine
def compute1_callback(path, data={}, **kwargs):
async def compute1_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -64,8 +62,7 @@ def test_create(async_run, project):
response.json = {"udp_port": 1024}
return response
@asyncio.coroutine
def compute2_callback(path, data={}, **kwargs):
async def compute2_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -107,8 +104,7 @@ def test_create_one_side_failure(async_run, project):
node2 = Node(project, compute2, "node2", node_type="vpcs")
node2._ports = [EthernetPort("E0", 0, 3, 1)]
@asyncio.coroutine
def subnet_callback(compute2):
async def subnet_callback(compute2):
"""
Fake subnet callback
"""
@@ -119,8 +115,7 @@ def test_create_one_side_failure(async_run, project):
link = UDPLink(project)
async_run(link.add_node(node1, 0, 4))
@asyncio.coroutine
def compute1_callback(path, data={}, **kwargs):
async def compute1_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -129,8 +124,7 @@ def test_create_one_side_failure(async_run, project):
response.json = {"udp_port": 1024}
return response
@asyncio.coroutine
def compute2_callback(path, data={}, **kwargs):
async def compute2_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -322,8 +316,7 @@ def test_update(async_run, project):
node2 = Node(project, compute2, "node2", node_type="vpcs")
node2._ports = [EthernetPort("E0", 0, 3, 1)]
@asyncio.coroutine
def subnet_callback(compute2):
async def subnet_callback(compute2):
"""
Fake subnet callback
"""
@@ -335,8 +328,7 @@ def test_update(async_run, project):
async_run(link.add_node(node1, 0, 4))
async_run(link.update_filters({"latency": [10]}))
@asyncio.coroutine
def compute1_callback(path, data={}, **kwargs):
async def compute1_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -345,8 +337,7 @@ def test_update(async_run, project):
response.json = {"udp_port": 1024}
return response
@asyncio.coroutine
def compute2_callback(path, data={}, **kwargs):
async def compute2_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -402,8 +393,7 @@ def test_update_suspend(async_run, project):
node2 = Node(project, compute2, "node2", node_type="vpcs")
node2._ports = [EthernetPort("E0", 0, 3, 1)]
@asyncio.coroutine
def subnet_callback(compute2):
async def subnet_callback(compute2):
"""
Fake subnet callback
"""
@@ -416,8 +406,7 @@ def test_update_suspend(async_run, project):
async_run(link.update_filters({"latency": [10]}))
async_run(link.update_suspend(True))
@asyncio.coroutine
def compute1_callback(path, data={}, **kwargs):
async def compute1_callback(path, data={}, **kwargs):
"""
Fake server
"""
@@ -426,8 +415,7 @@ def test_update_suspend(async_run, project):
response.json = {"udp_port": 1024}
return response
@asyncio.coroutine
def compute2_callback(path, data={}, **kwargs):
async def compute2_callback(path, data={}, **kwargs):
"""
Fake server
"""