mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-06-19 15:53:47 +00:00
Replace asyncio.async() by asyncio.ensure_future() in tests. Ref #2566.
This commit is contained in:
@ -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