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
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user