replace deprecated asyncio.get_event_loop()

`asyncio.get_event_loop()` was deprecated in Python 3.10, so we should use `asyncio.get_running_loop()` instead.
This commit is contained in:
David Lechner
2022-09-26 12:43:56 -05:00
committed by GitHub
parent c0671be366
commit 691ff8e1bf
10 changed files with 14 additions and 14 deletions

View File

@@ -270,7 +270,7 @@ async def test_property_changed_signal(interface_class):
async def wait_for_message():
# TODO timeout
future = asyncio.get_event_loop().create_future()
future = asyncio.get_running_loop().create_future()
def message_handler(signal):
if signal.interface == "org.freedesktop.DBus.Properties":

View File

@@ -60,7 +60,7 @@ class SecondExampleInterface(ServiceInterface):
class ExpectMessage:
def __init__(self, bus1, bus2, interface_name, timeout=1):
self.future = asyncio.get_event_loop().create_future()
self.future = asyncio.get_running_loop().create_future()
self.bus1 = bus1
self.bus2 = bus2
self.interface_name = interface_name
@@ -78,7 +78,7 @@ class ExpectMessage:
async def __aenter__(self):
self.bus2.add_message_handler(self.message_handler)
self.timeout_task = asyncio.get_event_loop().call_later(
self.timeout_task = asyncio.get_running_loop().call_later(
self.timeout, self.timeout_cb
)