Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dbus_next/aio/proxy_object.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -66,14 +66,18 @@ class ProxyInterface(BaseProxyInterface):
<dbus_next.DBusError>` 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)

Expand Down
4 changes: 4 additions & 0 deletions test/client/test_methods.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()
Expand Down