diff --git a/dbus_next/aio/proxy_object.py b/dbus_next/aio/proxy_object.py index 21a8f3a..7163199 100644 --- a/dbus_next/aio/proxy_object.py +++ b/dbus_next/aio/proxy_object.py @@ -1,6 +1,6 @@ from ..proxy_object import BaseProxyObject, BaseProxyInterface from ..message_bus import BaseMessageBus -from ..message import Message +from ..message import Message, MessageFlag from ..signature import Variant from ..errors import DBusError from ..constants import ErrorType @@ -66,14 +66,18 @@ class ProxyInterface(BaseProxyInterface): ` will be raised with information about the error. """ def _add_method(self, intr_method): - async def method_fn(*args): + async def method_fn(*args, flags=MessageFlag.NONE): msg = await self.bus.call( Message(destination=self.bus_name, path=self.path, interface=self.introspection.name, member=intr_method.name, signature=intr_method.in_signature, - body=list(args))) + body=list(args), + flags=flags)) + + if flags & MessageFlag.NO_REPLY_EXPECTED: + return None BaseProxyInterface._check_method_return(msg, intr_method.out_signature) diff --git a/test/client/test_methods.py b/test/client/test_methods.py index c94bcb9..5f2c6c0 100644 --- a/test/client/test_methods.py +++ b/test/client/test_methods.py @@ -1,3 +1,4 @@ +from dbus_next.message import MessageFlag from dbus_next.service import ServiceInterface, method import dbus_next.introspection as intr from dbus_next import aio, glib, DBusError @@ -75,6 +76,9 @@ async def test_aio_proxy_object(): result = await interface.call_echo_int64(-10000) assert result == -10000 + result = await interface.call_echo_string('no reply', flags=MessageFlag.NO_REPLY_EXPECTED) + assert result is None + with pytest.raises(DBusError): try: await interface.call_throws_error()