From 2739e4ce18a94bb5bdea971edc21fd7dc9b10e3c Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Sun, 17 Aug 2025 14:16:13 +0200 Subject: [PATCH] update for status table generation --- jsonlog.py | 31 +++++++++++-------------------- module_status.py | 11 +++++------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/jsonlog.py b/jsonlog.py index a401480..2aa7552 100644 --- a/jsonlog.py +++ b/jsonlog.py @@ -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 diff --git a/module_status.py b/module_status.py index 331d444..93db1f7 100644 --- a/module_status.py +++ b/module_status.py @@ -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)),