mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
All current iou code is async
This commit is contained in:
1 parent
d323234520
commit
15f89776d3
8 files changed
+97
-30
No files matched your search
@@ -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"
|
||||
Reference in new issue
Block a user