Replace asyncio.async() by asyncio.ensure_future() in tests. Ref #2566.

This commit is contained in:
grossmj
2018-08-24 18:52:15 +07:00
parent 089d25c79d
commit a3d1e865a8
19 changed files with 171 additions and 171 deletions

View File

@ -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):