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

+6 -7
View File
@@ -23,27 +23,26 @@ from gns3server.utils.asyncio.embed_shell import EmbedShell
def test_embed_shell_help(async_run):
class Application(EmbedShell):
@asyncio.coroutine
def hello(self):
async def hello(self):
"""
The hello world function
The hello usage
"""
pass
await asyncio.sleep(1)
reader = asyncio.StreamReader()
writer = asyncio.StreamReader()
app = Application(reader, writer)
assert async_run(app._parse_command('help')) == 'Help:\nhello: The hello world function\nhelp: Show help\n\nhelp command for details about a command\n'
assert async_run(app._parse_command('?')) == 'Help:\nhello: The hello world function\nhelp: Show help\n\nhelp command for details about a command\n'
assert async_run(app._parse_command('help')) == 'Help:\nhello: The hello world function\n\nhelp command for details about a command\n'
assert async_run(app._parse_command('?')) == 'Help:\nhello: The hello world function\n\nhelp command for details about a command\n'
assert async_run(app._parse_command('? hello')) == 'hello: The hello world function\n\nThe hello usage\n'
def test_embed_shell_execute(async_run):
class Application(EmbedShell):
@asyncio.coroutine
def hello(self):
async def hello(self):
"""
The hello world function
+2 -3
View File
@@ -85,10 +85,9 @@ def test_lock_decorator(loop):
self._test_val = 0
@locking
@asyncio.coroutine
def method_to_lock(self):
async def method_to_lock(self):
res = self._test_val
yield from asyncio.sleep(0.1)
await asyncio.sleep(0.1)
self._test_val += 1
return res