diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-27 17:40:37 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-07-27 17:41:33 +0200 |
commit | edc79fa9a0347959cd2afafc0c30de70e03002a6 (patch) | |
tree | 02a30eea0863cce2c5739a63995ab84446b6f942 | |
parent | rtemsspec: Add augment_with_test_links() (diff) | |
download | rtems-central-edc79fa9a0347959cd2afafc0c30de70e03002a6.tar.bz2 |
rtemsspec: Fix augment_with_test_links()
Add also parent links.
-rw-r--r-- | rtemsspec/items.py | 6 | ||||
-rw-r--r-- | rtemsspec/rtems.py | 1 | ||||
-rw-r--r-- | rtemsspec/tests/test_rtems.py | 1 |
3 files changed, 7 insertions, 1 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py index d9cee00b..2c0e25fa 100644 --- a/rtemsspec/items.py +++ b/rtemsspec/items.py @@ -382,8 +382,12 @@ class Item: for link in self.links_to_parents(): link.item.add_link_to_child(Link.create(link, self)) + def add_link_to_parent(self, link: Link): + """ Adds the link as a parent item link to this item. """ + self._links_to_parents.append(link) + def add_link_to_child(self, link: Link): - """ Adds a link to a child item of this items. """ + """ Adds the link as a child item link to this item. """ self._links_to_children.append(link) def is_enabled(self, enabled: List[str]): diff --git a/rtemsspec/rtems.py b/rtemsspec/rtems.py index b2bcfd12..97e9da82 100644 --- a/rtemsspec/rtems.py +++ b/rtemsspec/rtems.py @@ -43,6 +43,7 @@ def is_pre_qualified(item: Item) -> bool: def _add_link(item_cache: ItemCache, child: Item, link: Link) -> None: parent = item_cache[child.to_abs_uid(link["uid"])] parent.add_link_to_child(Link(child, link)) + child.add_link_to_parent(Link(parent, link)) def augment_with_test_links(item_cache: ItemCache) -> None: diff --git a/rtemsspec/tests/test_rtems.py b/rtemsspec/tests/test_rtems.py index f412a543..25894344 100644 --- a/rtemsspec/tests/test_rtems.py +++ b/rtemsspec/tests/test_rtems.py @@ -60,3 +60,4 @@ def test_augment_with_test_links(): test_case.data["_type"] = "test-case" augment_with_test_links(item_cache) assert item.child("validation") == test_case + assert test_case.parent("validation") == item |