mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Replace asyncio.async() by asyncio.ensure_future() in tests. Ref #2566.
This commit is contained in:
1 parent
089d25c79d
commit
a3d1e865a8
19 files changed
+171
-171
No files matched your search
@@ -31,7 +31,7 @@ def test_wait_run_in_executor(loop):
|
||||
return param
|
||||
|
||||
exec = wait_run_in_executor(change_var, "test")
|
||||
result = loop.run_until_complete(asyncio.async(exec))
|
||||
result = loop.run_until_complete(asyncio.ensure_future(exec))
|
||||
assert result == "test"
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ 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))
|
||||
result = loop.run_until_complete(asyncio.ensure_future(exec))
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||
@@ -52,7 +52,7 @@ def test_subprocess_check_output(loop, tmpdir, restore_original_path):
|
||||
with open(path, "w+") as f:
|
||||
f.write("TEST")
|
||||
exec = subprocess_check_output("cat", path)
|
||||
result = loop.run_until_complete(asyncio.async(exec))
|
||||
result = loop.run_until_complete(asyncio.ensure_future(exec))
|
||||
assert result == "TEST"
|
||||
|
||||
|
||||
@@ -64,13 +64,13 @@ def test_wait_for_process_termination(loop):
|
||||
process = MagicMock()
|
||||
process.returncode = 0
|
||||
exec = wait_for_process_termination(process)
|
||||
loop.run_until_complete(asyncio.async(exec))
|
||||
loop.run_until_complete(asyncio.ensure_future(exec))
|
||||
|
||||
process = MagicMock()
|
||||
process.returncode = None
|
||||
exec = wait_for_process_termination(process, timeout=0.5)
|
||||
with pytest.raises(asyncio.TimeoutError):
|
||||
loop.run_until_complete(asyncio.async(exec))
|
||||
loop.run_until_complete(asyncio.ensure_future(exec))
|
||||
|
||||
|
||||
def test_lock_decorator(loop):
|
||||
|
||||
Reference in new issue
Block a user