Skip to content

Commit dcc2b1a

Browse files
Merge pull request #143 from OPpuolitaival/ollpuo01
Fix greentea html generation in some cases
2 parents 6a6133d + fdfeb63 commit dcc2b1a

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ __pycache__/
99
mbedls.json
1010
build/
1111
dist/
12+
.idea

src/mbed_os_tools/test/mbed_report_api.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -544,16 +544,23 @@ def get_result_overlay_testcase_dropdown(result_div_id, index, testcase_result_n
544544

545545
testcase_utest_log_dropdown = get_dropdown_html(testcase_utest_div_id,
546546
"uTest Log",
547-
"\n".join(testcase_result['utest_log']).rstrip("\n"),
547+
"\n".join(testcase_result.get('utest_log', 'n/a')).rstrip("\n"),
548548
output_text=True,
549549
sub_dropdown=True)
550550

551-
testcase_info = testcase_result_template % (testcase_result['result_text'],
552-
testcase_result['duration'],
553-
datetime.datetime.fromtimestamp(testcase_result['time_start']).strftime('%d-%m-%Y %H:%M:%S.%f'),
554-
datetime.datetime.fromtimestamp(testcase_result['time_end']).strftime('%d-%m-%Y %H:%M:%S.%f'),
555-
testcase_result['failed'],
556-
testcase_result['passed'],
551+
time_start = 'n/a'
552+
time_end = 'n/a'
553+
if 'time_start' in testcase_result.keys():
554+
time_start = datetime.datetime.fromtimestamp(testcase_result['time_start']).strftime('%d-%m-%Y %H:%M:%S.%f')
555+
if 'time_end' in testcase_result.keys():
556+
time_end = datetime.datetime.fromtimestamp(testcase_result['time_end']).strftime('%d-%m-%Y %H:%M:%S.%f')
557+
558+
testcase_info = testcase_result_template % (testcase_result.get('result_text', 'n/a'),
559+
testcase_result.get('duration', 'n/a'),
560+
time_start,
561+
time_end,
562+
testcase_result.get('failed', 'n/a'),
563+
testcase_result.get('passed', 'n/a'),
557564
testcase_utest_log_dropdown)
558565

559566
testcase_class = get_result_colour_class(testcase_result['result_text'])
@@ -564,6 +571,7 @@ def get_result_overlay_testcase_dropdown(result_div_id, index, testcase_result_n
564571
sub_dropdown=True)
565572
return testcase_dropdown
566573

574+
567575
def get_result_overlay_testcases_dropdown_menu(result_div_id, test_results):
568576
"""! Get the HTML for a test overlay's testcase dropdown menu
569577
@param result_div_id The div id used for the test

0 commit comments

Comments
 (0)