[rtems-central commit] items: Add link_is_enabled()

Sebastian Huber sebh at rtems.org
Mon Jun 26 19:05:41 UTC 2023


Module:    rtems-central
Branch:    master
Commit:    356edbfca90028ef5aef1cc4b0c2d45fb1130f31
Changeset: http://git.rtems.org/rtems-central/commit/?id=356edbfca90028ef5aef1cc4b0c2d45fb1130f31

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed May 10 10:30:52 2023 +0200

items: Add link_is_enabled()

---

 rtemsspec/items.py                 | 5 +++++
 rtemsspec/tests/test_items_item.py | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 5a4109c7..7ae07ab4 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -197,6 +197,11 @@ def _is_link_enabled(link: Link) -> bool:
     return link.item._data["_enabled"]  # pylint: disable=protected-access
 
 
+def link_is_enabled(_link: Link) -> bool:
+    """ Returns true. """
+    return True
+
+
 class Item:
     """ Objects of this class represent a specification item. """
 
diff --git a/rtemsspec/tests/test_items_item.py b/rtemsspec/tests/test_items_item.py
index 9a119891..1b4dd9f4 100644
--- a/rtemsspec/tests/test_items_item.py
+++ b/rtemsspec/tests/test_items_item.py
@@ -28,7 +28,7 @@ import os
 import pytest
 
 from rtemsspec.items import EmptyItemCache, Item, ItemGetValueContext, \
-    JSONItemCache, Link
+    JSONItemCache, link_is_enabled, Link
 
 
 def test_to_abs_uid():
@@ -193,6 +193,8 @@ def test_parents():
     assert child["links"][0]["foo"] == "bar"
     parents = [item for item in child.parents()]
     assert len(parents) == 1
+    parents = [item for item in child.parents(is_link_enabled=link_is_enabled)]
+    assert len(parents) == 2
     assert parents[0] == parent
     parents = [item for item in child.parents("c")]
     assert len(parents) == 1



More information about the vc mailing list