coverage optimisation for smart_brain unittest - template + coverage class

This commit is contained in:
Dirk Alders 2025-08-29 19:29:53 +02:00
parent e5282ac16a
commit e3073141d2
2 changed files with 7 additions and 2 deletions

8
run.py
View File

@ -73,9 +73,13 @@ class coverage_info(list):
list.__init__(self)
xmldoc = xml.dom.minidom.parse(xml_filename)
itemlist = xmldoc.getElementsByTagName('package')
if module_basepath is None:
offset_mod_path = 0
else:
offset_mod_path = len(module_basepath) + 1
for p in itemlist:
module = {}
module[jsonlog.COVI_KEY_NAME] = p.attributes['name'].value[len(module_basepath) + 1:]
module[jsonlog.COVI_KEY_NAME] = p.attributes['name'].value[offset_mod_path:]
module[jsonlog.COVI_KEY_FILEPATH] = p.attributes['name'].value.replace('.', os.path.sep)
module[jsonlog.COVI_KEY_LINE_COVERAGE] = float(p.attributes['line-rate'].value) * 100.
try:
@ -85,7 +89,7 @@ class coverage_info(list):
module[jsonlog.COVI_KEY_FILES] = []
for c in p.getElementsByTagName('class'):
f = {}
f[jsonlog.COVI_KEY_NAME] = c.attributes['filename'].value[len(module_basepath) + 1:].replace(os.path.sep, '.')
f[jsonlog.COVI_KEY_NAME] = c.attributes['filename'].value[offset_mod_path:].replace(os.path.sep, '.')
f[jsonlog.COVI_KEY_FILEPATH] = c.attributes['filename'].value
f[jsonlog.COVI_KEY_LINE_COVERAGE] = float(c.attributes['line-rate'].value) * 100.
try:

View File

@ -42,6 +42,7 @@
{ä}{ {\"a} }1
{ö}{ {\"o} }1
{~}{ {\textasciitilde} }1
{°}{ {\textdegree} }1
}
\usepackage{color}
\definecolor{bg-partially-covered}{rgb}{1,1,0.6} % light-yellow