publish conditions implemented
This commit is contained in:
parent
6e3cf6df4f
commit
5417bf1cba
12
jsonlog.py
12
jsonlog.py
@ -4,10 +4,11 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import report
|
||||
import subprocess
|
||||
|
||||
import fstools
|
||||
from unittest.output import STATUS_AVAILABLE, STATUS_CHANGED, STATUS_CLEAN, STATUS_EXISTS, STATUS_FAILED, STATUS_IN_WORK, STATUS_MISSING, STATUS_OLD, STATUS_RELEASED, STATUS_UNKNOWN
|
||||
from unittest.output import STATUS_AVAILABLE, STATUS_CHANGED, STATUS_CLEAN, STATUS_EXISTS, STATUS_FAILED, STATUS_IN_WORK, STATUS_MISSING, STATUS_OLD, STATUS_RELEASED, STATUS_UNKNOWN, STATUS_INCOMPLETE
|
||||
|
||||
JSONLOG_FNAME = 'unittest.json'
|
||||
|
||||
@ -65,6 +66,7 @@ TOBI_VERSION = "Version"
|
||||
# SUBKEYS FOR MAIN_KEY_TESTRUNS
|
||||
#
|
||||
TRUN_TESTCASES = 'testcases'
|
||||
TRUN_EXEC_LVL = 'testcase_execution_level'
|
||||
#
|
||||
# SUBKEYS FOR MAIN_KEY_UNITTEST_INFO
|
||||
#
|
||||
@ -123,12 +125,14 @@ def __get_release_state__(ut_folder, lib):
|
||||
return STATUS_MISSING
|
||||
else:
|
||||
ut_status = ut_data.get(MAIN_KEY_TESTOBJECT_INFO, {}).get(TOBI_STATE, 'unknown')
|
||||
if ut_status == TOBI_STATE_RELEASED:
|
||||
ut_level = ut_data.get(MAIN_KEY_TESTRUNS, [{}, {}])[0].get(TRUN_EXEC_LVL, report.TCEL_SINGLE)
|
||||
if ut_status == TOBI_STATE_RELEASED and ut_level == report.TCEL_FULL:
|
||||
return STATUS_RELEASED
|
||||
elif ut_status == TOBI_STATE_IN_DEVELOPMENT:
|
||||
elif ut_status != TOBI_STATE_RELEASED:
|
||||
return STATUS_IN_WORK
|
||||
elif ut_level != report.TCEL_FULL:
|
||||
return STATUS_INCOMPLETE
|
||||
else:
|
||||
print(ut_status)
|
||||
return STATUS_UNKNOWN
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ STATUS_CHANGED = 'CHANGED'
|
||||
STATUS_EXISTS = 'EXISTS'
|
||||
STATUS_IN_WORK = 'IN_WORK'
|
||||
STATUS_OLD = 'OLD'
|
||||
STATUS_INCOMPLETE = 'INCOMPLETE'
|
||||
#
|
||||
STATUS_FAILED = 'FAILED'
|
||||
STATUS_MISSING = 'MISSING'
|
||||
@ -41,6 +42,7 @@ STATUS_COLORS = {
|
||||
STATUS_EXISTS: termcolors.WARNING,
|
||||
STATUS_IN_WORK: termcolors.WARNING,
|
||||
STATUS_OLD: termcolors.WARNING,
|
||||
STATUS_INCOMPLETE: termcolors.WARNING,
|
||||
#
|
||||
STATUS_FAILED: termcolors.FAIL,
|
||||
STATUS_MISSING: termcolors.FAIL,
|
||||
|
42
run.py
42
run.py
@ -325,21 +325,35 @@ def unittest_finalise(ut_folder):
|
||||
|
||||
def unittest_publish(ut_folder):
|
||||
config = imp.load_source('', jsonlog.get_ut_config(ut_folder))
|
||||
#
|
||||
output.print_header('Copy unittest files to library')
|
||||
target_folder = os.path.join(config.lib_path, '_testresults_')
|
||||
output.print_action('Copying Unittest Files to %s' % target_folder)
|
||||
if not os.path.exists(target_folder):
|
||||
output.print_info('Creating folder %s' % target_folder)
|
||||
fstools.mkdir(target_folder)
|
||||
output.print_header('Checking testrun state')
|
||||
output.print_action('Release State...')
|
||||
rs = jsonlog.get_ut_release_state(ut_folder)
|
||||
output.print_info(rs)
|
||||
output.print_action('Testcase Integrity...')
|
||||
tci = jsonlog.get_ut_testcase_integrity(ut_folder)
|
||||
output.print_info(tci)
|
||||
output.print_action('Source Integrity...')
|
||||
sri = jsonlog.get_ut_src_integrity(ut_folder)
|
||||
output.print_info(sri)
|
||||
|
||||
if rs == jsonlog.STATUS_RELEASED and tci == jsonlog.STATUS_CLEAN and sri == jsonlog.STATUS_CLEAN:
|
||||
output.print_header('Copy unittest files to library')
|
||||
target_folder = os.path.join(config.lib_path, '_testresults_')
|
||||
output.print_action('Copying Unittest Files to %s' % target_folder)
|
||||
if not os.path.exists(target_folder):
|
||||
output.print_info('Creating folder %s' % target_folder)
|
||||
fstools.mkdir(target_folder)
|
||||
else:
|
||||
for fn in os.listdir(target_folder):
|
||||
remove_file(os.path.join(target_folder, fn))
|
||||
for fn in REPORT_FILES:
|
||||
src = testresults_filename(ut_folder, fn)
|
||||
dst = os.path.join(target_folder, fn)
|
||||
output.print_info('copying %s -> %s' % (src, dst))
|
||||
shutil.copyfile(src, dst)
|
||||
else:
|
||||
for fn in os.listdir(target_folder):
|
||||
remove_file(os.path.join(target_folder, fn))
|
||||
for fn in REPORT_FILES:
|
||||
src = testresults_filename(ut_folder, fn)
|
||||
dst = os.path.join(target_folder, fn)
|
||||
output.print_info('copying %s -> %s' % (src, dst))
|
||||
shutil.copyfile(src, dst)
|
||||
output.print_action('Proceed Conditions...')
|
||||
output.print_info(output.STATUS_FAILED)
|
||||
|
||||
|
||||
def unittest_status(ut_folder):
|
||||
|
Loading…
x
Reference in New Issue
Block a user