update for status table generation

This commit is contained in:
Dirk Alders 2025-08-17 14:16:13 +02:00
parent 874af7b642
commit 2739e4ce18
2 changed files with 16 additions and 26 deletions

View File

@ -199,31 +199,22 @@ def get_ut_src_integrity(ut_folder):
def status_lib_unittest(ut_folder):
if get_lib_release_state(ut_folder) == STATUS_RELEASED and get_lib_src_integrity(ut_folder) == STATUS_CLEAN and get_lib_testcase_integrity(ut_folder) == STATUS_CLEAN:
release_state = get_lib_release_state(ut_folder)
# print("release_state", release_state)
src_integrity = get_lib_src_integrity(ut_folder)
# print("src_integrity", src_integrity)
testcase_integrity = get_lib_testcase_integrity(ut_folder)
# print("testcase_integrity", testcase_integrity)
if release_state == STATUS_RELEASED and src_integrity == STATUS_CLEAN and testcase_integrity == STATUS_CLEAN:
return STATUS_CLEAN
elif get_lib_release_state(ut_folder) == STATUS_MISSING and get_lib_src_integrity(ut_folder) == STATUS_MISSING and get_lib_testcase_integrity(ut_folder) == STATUS_MISSING:
elif release_state == STATUS_MISSING and src_integrity == STATUS_MISSING and testcase_integrity == STATUS_MISSING:
return STATUS_MISSING
elif get_lib_release_state(ut_folder) == STATUS_IN_WORK or get_lib_src_integrity(ut_folder) == STATUS_IN_WORK or get_lib_testcase_integrity(ut_folder) == STATUS_IN_WORK:
elif release_state == STATUS_IN_WORK or src_integrity == STATUS_CHANGED or testcase_integrity == STATUS_IN_WORK:
return STATUS_IN_WORK
else:
return STATUS_UNKNOWN
def versions_module(ut_folder):
try:
with open(get_ut_jsonlog(ut_folder), 'r') as fh:
ut = json.loads(fh.read())
except IOError:
return STATUS_UNKNOWN
else:
interpreters = ut.get(MAIN_KEY_TESTOBJECT_INFO, {}).get(TOBI_SUPP_INTERP, '')
interpreters = interpreters.split(',')
for i in range(len(interpreters)):
interpreters[i] = interpreters[i].strip()
interpreters[i] = interpreters[i][6:]
return ', '.join(interpreters)
def __get_coverage__(ut_folder, lib):
if lib:
fn = get_lib_jsonlog(ut_folder)
@ -262,10 +253,10 @@ def status_git(ut_folder):
def status_doc(ut_folder):
if os.path.exists(os.path.join(get_lib_folder(ut_folder), '_docs_', 'index.html')):
if os.path.exists(os.path.join(get_lib_folder(ut_folder), '_docs_')):
return STATUS_AVAILABLE
else:
if os.path.exists(os.path.join(ut_folder, 'docs', 'index.rst')):
if os.path.exists(os.path.join(ut_folder, 'docs')):
return STATUS_IN_WORK
else:
return STATUS_MISSING

View File

@ -7,7 +7,7 @@ import os
from unittest.output import termcolors, coverage_output
from unittest.output import STATUS_COLORS, STATUS_UNKNOWN
from unittest.jsonlog import lib_coverage, status_doc, status_git, status_lib_unittest, status_spec, versions_module
from unittest.jsonlog import lib_coverage, status_doc, status_git, status_lib_unittest, status_spec
STATUS_LENGTH = 13
@ -20,26 +20,25 @@ def status_output(status_or_text, default_color=STATUS_COLORS[STATUS_UNKNOWN]):
def module_status_head():
rv = termcolors.BOLD + termcolors.UNDERLINE + 'Status of the unittests for pylibs:\n' + termcolors.ENDC
LINE_FORMAT = '%25s%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's\n'
LINE_FORMAT = '%25s%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's%' + \
str(STATUS_LENGTH) + 's%' + str(STATUS_LENGTH) + 's\n'
rv += termcolors.BOLD + termcolors.HEADER + LINE_FORMAT % (
'Library',
'UT-Status',
'DOC-Status',
'Versions',
'UT-Coverage',
'SPEC-Status',
'GIT-Status',
)
rv += (25 + 6 * STATUS_LENGTH) * '-' + '\n' + termcolors.ENDC
rv += (25 + 5 * STATUS_LENGTH) * '-' + '\n' + termcolors.ENDC
return rv
def module_status_line(ut_folder):
rv = '%25s%s%s%s%s%s%s\n' % (
rv = '%25s%s%s%s%s%s\n' % (
os.path.basename(ut_folder) + ':',
status_output(status_lib_unittest(ut_folder)),
status_output(status_doc(ut_folder)),
status_output(versions_module(ut_folder), termcolors.BOLD),
coverage_output(*lib_coverage(ut_folder), length=STATUS_LENGTH),
status_output(status_spec(ut_folder)),
status_output(status_git(ut_folder)),