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

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

No files matched your search

+4 -4
View File
@@ -56,8 +56,8 @@ def test_start_capture(vm, tmpdir, manager, free_console_port, loop):
output_file = str(tmpdir / "test.pcap")
nio = manager.create_nio({"type": "nio_udp", "lport": free_console_port, "rport": free_console_port, "rhost": "127.0.0.1"})
vm.adapters = 1
loop.run_until_complete(asyncio.async(vm.adapter_add_nio_binding(0, nio)))
loop.run_until_complete(asyncio.async(vm.start_capture(0, output_file)))
loop.run_until_complete(asyncio.ensure_future(vm.adapter_add_nio_binding(0, nio)))
loop.run_until_complete(asyncio.ensure_future(vm.start_capture(0, output_file)))
assert vm._ethernet_adapters[0].get_nio(0).capturing
@@ -66,8 +66,8 @@ def test_stop_capture(vm, tmpdir, manager, free_console_port, loop):
output_file = str(tmpdir / "test.pcap")
nio = manager.create_nio({"type": "nio_udp", "lport": free_console_port, "rport": free_console_port, "rhost": "127.0.0.1"})
vm.adapters = 1
loop.run_until_complete(asyncio.async(vm.adapter_add_nio_binding(0, nio)))
loop.run_until_complete(asyncio.ensure_future(vm.adapter_add_nio_binding(0, nio)))
loop.run_until_complete(vm.start_capture(0, output_file))
assert vm._ethernet_adapters[0].get_nio(0).capturing
loop.run_until_complete(asyncio.async(vm.stop_capture(0)))
loop.run_until_complete(asyncio.ensure_future(vm.stop_capture(0)))
assert vm._ethernet_adapters[0].get_nio(0).capturing is False