Replace asyncio.async with ensure_future because of deprecation, Fixes: #1269

This commit is contained in:
ziajka committed 2018-01-24 11:11:53 +01:00
1 parent 838d82a98b
commit d9a0ec9ff3
36 files changed
+192 -192

No files matched your search

+5 -5
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):