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:
@@ -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":
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user