summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-18 14:51:08 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-04-18 14:52:34 +0200
commita4e08c54d4682b445145ce12a4c353d0caa3a7b3 (patch)
tree207df2c458ac841fad90e25bb1a97dbe8d8b7120
parent8230acb305029bd6f628244330a3be533649ba80 (diff)
Enable branch coverage
Diffstat (limited to '')
-rw-r--r--Makefile2
-rw-r--r--rtemsqual/glossary.py5
-rw-r--r--rtemsqual/tests/spec-applconfig/j.yml2
-rw-r--r--rtemsqual/tests/spec-applconfig/m.yml16
-rw-r--r--rtemsqual/tests/spec-build/bsp2.yml11
-rw-r--r--rtemsqual/tests/test_applconfig.py24
-rw-r--r--rtemsqual/tests/test_content_sphinx.py8
7 files changed, 61 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index eb241787..6556bbec 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ PY_ALL_FILES = $(PY_SRC_FILES) $(wildcard rtemsqual/tests/*.py)
all: check format analyse coverage-report
check: check-env
- coverage run -m pytest -vv rtemsqual/tests
+ coverage run --branch -m pytest -vv rtemsqual/tests
format: $(PY_ALL_FILES) | check-env
yapf -i $^
diff --git a/rtemsqual/glossary.py b/rtemsqual/glossary.py
index 5100a4b3..b9aa4f6c 100644
--- a/rtemsqual/glossary.py
+++ b/rtemsqual/glossary.py
@@ -97,9 +97,8 @@ def _resolve_glossary_terms(document_terms: ItemMap,
def _generate_project_glossary(target: str, project_terms: ItemMap) -> None:
- if target:
- content = _generate_glossary_content(project_terms)
- content.write(target)
+ content = _generate_glossary_content(project_terms)
+ content.write(target)
def _generate_document_glossary(config: dict, project_terms: ItemMap) -> None:
diff --git a/rtemsqual/tests/spec-applconfig/j.yml b/rtemsqual/tests/spec-applconfig/j.yml
index 28fee938..92c07cd4 100644
--- a/rtemsqual/tests/spec-applconfig/j.yml
+++ b/rtemsqual/tests/spec-applconfig/j.yml
@@ -1,6 +1,6 @@
SPDX-License-Identifier: CC-BY-SA-4.0
appl-config-option-type: integer
-appl-config-option-default-value: 1
+appl-config-option-default-value: Foo bar.
appl-config-option-description: description j
appl-config-option-index: []
appl-config-option-name: j
diff --git a/rtemsqual/tests/spec-applconfig/m.yml b/rtemsqual/tests/spec-applconfig/m.yml
new file mode 100644
index 00000000..e5f5b2b8
--- /dev/null
+++ b/rtemsqual/tests/spec-applconfig/m.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+appl-config-option-type: initializer
+appl-config-option-default-value: 1
+appl-config-option-description: description m
+appl-config-option-index: []
+appl-config-option-name: m
+appl-config-option-notes: null
+appl-config-option-constraint:
+ some: garbage
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: []
+interface-type: appl-config-option
+links:
+- g: null
+type: interface
diff --git a/rtemsqual/tests/spec-build/bsp2.yml b/rtemsqual/tests/spec-build/bsp2.yml
new file mode 100644
index 00000000..f87e741b
--- /dev/null
+++ b/rtemsqual/tests/spec-build/bsp2.yml
@@ -0,0 +1,11 @@
+arch: foo
+bsp: bla
+build-type: bsp
+enabled-by: []
+install:
+- source:
+ - blub
+links: []
+source:
+- nada
+type: build
diff --git a/rtemsqual/tests/test_applconfig.py b/rtemsqual/tests/test_applconfig.py
index e5f688bc..ec13bd51 100644
--- a/rtemsqual/tests/test_applconfig.py
+++ b/rtemsqual/tests/test_applconfig.py
@@ -253,7 +253,7 @@ def test_applconfig(tmpdir):
" This configuration option is an integer define.\n"
"\n"
"DEFAULT VALUE:\n"
- " The default value is 1.\n"
+ " Foo bar.\n"
"\n"
"VALUE CONSTRAINTS:\n"
" The value of this configuration option shall satisfy all of the following\n"
@@ -323,5 +323,27 @@ def test_applconfig(tmpdir):
" description l\n"
"\n"
"NOTES:\n"
+ " None.\n"
+ "\n"
+ ".. index:: m\n"
+ "\n"
+ ".. _m:\n"
+ "\n"
+ "m\n"
+ "-\n"
+ "\n"
+ "CONSTANT:\n"
+ " ``m``\n"
+ "\n"
+ "OPTION TYPE:\n"
+ " This configuration option is an initializer define.\n"
+ "\n"
+ "DEFAULT VALUE:\n"
+ " The default value is 1.\n"
+ "\n"
+ "DESCRIPTION:\n"
+ " description m\n"
+ "\n"
+ "NOTES:\n"
" None.\n")
assert content == src.read()
diff --git a/rtemsqual/tests/test_content_sphinx.py b/rtemsqual/tests/test_content_sphinx.py
index 6fa3acb7..aaa85f93 100644
--- a/rtemsqual/tests/test_content_sphinx.py
+++ b/rtemsqual/tests/test_content_sphinx.py
@@ -24,6 +24,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+import os
import pytest
from rtemsqual.content import SphinxContent
@@ -109,7 +110,12 @@ def test_license_and_copyrights():
def test_write(tmpdir):
sc = SphinxContent()
sc.add_line("x")
- path = tmpdir + "/y/z"
+ path = os.path.join(tmpdir, "x", "y")
+ sc.write(path)
+ with open(path, "r") as src:
+ assert "x\n" == src.read()
+ tmpdir.chdir()
+ path = "z"
sc.write(path)
with open(path, "r") as src:
assert "x\n" == src.read()