Skip to content

Commit d39fd5d

Browse files
committed
BaseProxyObject: construct child proxy objects with correct paths
BaseProxyObject.get_children() was constructing child proxy objects using the parent object's path. This commit corrects that.
1 parent 969d8be commit d39fd5d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/dbus_fast/proxy_object.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ def get_children(self) -> list[BaseProxyObject]:
351351
"""Get the child nodes of this proxy object according to the introspection data."""
352352
if self._children is None:
353353
self._children = [
354-
self.__class__(self.bus_name, self.path, child, self.bus)
354+
self.__class__(self.bus_name, f"{self.path}/{child.name}",
355+
child, self.bus)
355356
for child in self.introspection.nodes
356357
]
357358

tests/test_introspection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
)
1111
from dbus_fast import introspection as intr
1212
from dbus_fast.constants import ErrorType
13-
from dbus_fast.errors import DBusError
13+
from dbus_fast.errors import DBusError, InterfaceNotFoundError
1414
from dbus_fast.message_bus import BaseMessageBus
1515
from dbus_fast.proxy_object import BaseProxyObject, BaseProxyInterface
1616

@@ -206,7 +206,6 @@ def __init__(self,
206206
super().__init__(bus_name, path, introspection, bus, MockProxyInterface)
207207

208208

209-
@pytest.mark.xfail(reason='buggy BaseProxyObject.get_children', raises=AssertionError, strict=True)
210209
def test_inline_child():
211210
bus = MockMessageBus({
212211
'com.example': {
@@ -255,7 +254,7 @@ def test_inline_child():
255254
assert bus.introspect_count == 1
256255

257256

258-
@pytest.mark.xfail(reason='buggy BaseProxyObject.get_children', raises=AssertionError, strict=True)
257+
@pytest.mark.xfail(reason='buggy BaseProxyObject.get_children', raises=InterfaceNotFoundError, strict=True)
259258
def test_noninline_child():
260259
obj0_node = intr.Node.parse(strict_data)
261260
bus = MockMessageBus({

0 commit comments

Comments
 (0)