|
@@ -333,11 +333,11 @@ def unittest_finalise(unittest_folder):
|
333
|
333
|
#
|
334
|
334
|
print_action("Adding Lost Requirement Soul")
|
335
|
335
|
data_collection['lost_souls']['item_list'] = []
|
336
|
|
- for req_id in data_collection['specification'].get('item_dict', {}):
|
337
|
|
- item = data_collection['specification']['item_dict'][req_id]
|
|
336
|
+ for req_id in data_collection[UNITTEST_KEY_SPECIFICATION].get('item_dict', {}):
|
|
337
|
+ item = data_collection[UNITTEST_KEY_SPECIFICATION]['item_dict'][req_id]
|
338
|
338
|
if item['system_type_uid'] == '_MR7eNHYYEem_kd-7nxt1sg':
|
339
|
339
|
testcase_available = False
|
340
|
|
- for testrun in data_collection['testrun_list']:
|
|
340
|
+ for testrun in data_collection[UNITTEST_KEY_TESTRUNS]:
|
341
|
341
|
if req_id in testrun['testcases']:
|
342
|
342
|
testcase_available = True
|
343
|
343
|
break
|
|
@@ -347,9 +347,9 @@ def unittest_finalise(unittest_folder):
|
347
|
347
|
#
|
348
|
348
|
print_action("Adding Lost Testcase Soul")
|
349
|
349
|
data_collection['lost_souls']['testcase_list'] = []
|
350
|
|
- for testrun in data_collection['testrun_list']:
|
|
350
|
+ for testrun in data_collection[UNITTEST_KEY_TESTRUNS]:
|
351
|
351
|
for tc_id in testrun.get('testcases', {}):
|
352
|
|
- if tc_id not in data_collection['specification'].get('item_dict', {}) and tc_id not in data_collection['lost_souls']['testcase_list']:
|
|
352
|
+ if tc_id not in data_collection[UNITTEST_KEY_SPECIFICATION].get('item_dict', {}) and tc_id not in data_collection['lost_souls']['testcase_list']:
|
353
|
353
|
data_collection['lost_souls']['testcase_list'].append(tc_id)
|
354
|
354
|
print_info('"%s" has no corresponding testcase' % tc_id, FAIL)
|
355
|
355
|
#
|
|
@@ -398,8 +398,6 @@ def unittest_publish(unittest_folder):
|
398
|
398
|
|
399
|
399
|
|
400
|
400
|
def unittest_status(unittest_folder):
|
401
|
|
- config = imp.load_source('', os.path.join(unittest_folder, 'src', 'config.py'))
|
402
|
|
- #
|
403
|
401
|
print_header('Checking status of all submodules')
|
404
|
402
|
print_action('Updating all submodules (fetch)')
|
405
|
403
|
process = subprocess.Popen("LANGUAGE='en_US.UTF-8 git' git submodule foreach git fetch", cwd=os.path.dirname(unittest_folder), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
@@ -427,7 +425,7 @@ def unittest_status(unittest_folder):
|
427
|
425
|
data[m] += line
|
428
|
426
|
for key in data:
|
429
|
427
|
if "working tree clean" not in data[key] and "working directory clean" not in data[key]:
|
430
|
|
- data[key] = ("local changes", WARNING)
|
|
428
|
+ data[key] = ("local changes", FAIL)
|
431
|
429
|
elif "Your branch is behind" in data[key]:
|
432
|
430
|
data[key] = ("no up to date (try git pull)", FAIL)
|
433
|
431
|
elif "HEAD detached at" in data[key]:
|
|
@@ -447,19 +445,16 @@ def unittest_status(unittest_folder):
|
447
|
445
|
with open(unittest_filename(unittest_folder, FILES['data-collection']), 'r') as fh:
|
448
|
446
|
data_collection = json.loads(fh.read())
|
449
|
447
|
print_action('Checking release state of this testrun... ')
|
450
|
|
- if data_collection['testobject_information']['State'] != 'Released':
|
|
448
|
+ if data_collection[UNITTEST_KEY_TESTOBJECT_INFO]['State'] != 'Released':
|
451
|
449
|
print_info("FAILED", FAIL)
|
452
|
450
|
else:
|
453
|
451
|
print_info("SUCCESS", OKGREEN)
|
454
|
452
|
#
|
455
|
|
- print_action('Checking up to dateness of testrults in library...')
|
456
|
|
- try:
|
457
|
|
- with open(os.path.join(unittest_folder, '..', 'pylibs', config.lib.__name__, '_testresults_', FILES['data-collection']), 'r') as fh:
|
458
|
|
- lib_result = json.loads(fh.read())
|
459
|
|
- except FileNotFoundError:
|
460
|
|
- print_info("FAILED: Testresults not in library", FAIL)
|
461
|
|
- else:
|
462
|
|
- if data_collection['testobject_information'] != lib_result['testobject_information'] or data_collection['unittest_information'] != lib_result['unittest_information']:
|
463
|
|
- print_info("FAILED", FAIL)
|
464
|
|
- else:
|
465
|
|
- print_info("SUCCESS", OKGREEN)
|
|
453
|
+ from unittest.module_status import module_unittest_status
|
|
454
|
+ print_action('Checking status of testrults in library...')
|
|
455
|
+ st = module_unittest_status(os.path.abspath(os.path.join(unittest_folder, '..')))
|
|
456
|
+ stc = {
|
|
457
|
+ 'RELEASED': OKGREEN,
|
|
458
|
+ 'IN_WORK': OKBLUE,
|
|
459
|
+ }.get(st, FAIL)
|
|
460
|
+ print_info(st, stc)
|