[rtems-central commit] glossary: Make project glossary optional

Sebastian Huber sebh at rtems.org
Mon Oct 26 13:09:23 UTC 2020


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Oct 26 13:55:07 2020 +0100

glossary: Make project glossary optional

---

 rtemsspec/glossary.py            |  3 ++-
 rtemsspec/tests/test_glossary.py | 11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/rtemsspec/glossary.py b/rtemsspec/glossary.py
index 1a7a18c..c744587 100644
--- a/rtemsspec/glossary.py
+++ b/rtemsspec/glossary.py
@@ -106,7 +106,8 @@ def _resolve_glossary_terms(document_terms: ItemMap) -> None:
 
 def _generate_project_glossary(glossary: _Glossary, header: str,
                                target: str) -> None:
-    _generate_glossary_content(glossary.uid_to_item, header, target)
+    if target:
+        _generate_glossary_content(glossary.uid_to_item, header, target)
 
 
 def _generate_document_glossary(config: dict, glossary: _Glossary) -> None:
diff --git a/rtemsspec/tests/test_glossary.py b/rtemsspec/tests/test_glossary.py
index 030e215..62383f3 100644
--- a/rtemsspec/tests/test_glossary.py
+++ b/rtemsspec/tests/test_glossary.py
@@ -27,10 +27,19 @@
 import os
 
 from rtemsspec.glossary import generate
-from rtemsspec.items import ItemCache
+from rtemsspec.items import EmptyItemCache, ItemCache
 from rtemsspec.tests.util import create_item_cache_config_and_copy_spec
 
 
+def test_empty_glossary():
+    glossary_config = {}
+    glossary_config["project-groups"] = []
+    glossary_config["project-header"] = None
+    glossary_config["project-target"] = None
+    glossary_config["documents"] = []
+    generate(glossary_config, EmptyItemCache())
+
+
 def test_glossary(tmpdir):
     item_cache_config = create_item_cache_config_and_copy_spec(
         tmpdir, "spec-glossary", with_spec_types=True)



More information about the vc mailing list