All current iou code is async

This commit is contained in:
Julien Duponchelle
2015-02-16 17:20:07 +01:00
parent d323234520
commit 15f89776d3
8 changed files with 97 additions and 30 deletions

View File

@ -19,7 +19,7 @@
import asyncio
import pytest
from gns3server.utils.asyncio import wait_run_in_executor
from gns3server.utils.asyncio import wait_run_in_executor, subprocess_check_output
def test_wait_run_in_executor(loop):
@ -40,3 +40,13 @@ def test_exception_wait_run_in_executor(loop):
exec = wait_run_in_executor(raise_exception)
with pytest.raises(Exception):
result = loop.run_until_complete(asyncio.async(exec))
def test_subprocess_check_output(loop, tmpdir, restore_original_path):
path = str(tmpdir / "test")
with open(path, "w+") as f:
f.write("TEST")
exec = subprocess_check_output("cat", path)
result = loop.run_until_complete(asyncio.async(exec))
assert result == "TEST"