tests: fix TypeError in run_tests.py

Traceback (most recent call last):
  File "run_tests.py", line 886, in <module>
    exit_code, suites = parse_results(results)
  File "run_tests.py", line 732, in parse_results
    results_per_suite.print_results()
  File "run_tests.py", line 683, in print_results
    result.get_testcase_names(failed_test_id)
TypeError: 'NoneType' object is not iterable

Type: test

Change-Id: I2c5ae0b9e11be6bfb4490d9ce057db0b0a84c9bf
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
This commit is contained in:
Paul Vinciguerra
2019-12-10 23:36:05 -05:00
committed by Dave Wallace
parent 56cef059ef
commit 67a7749cac

View File

@ -646,7 +646,7 @@ class AllResults(dict):
failed_testcase_ids = result[FAIL]
errored_testcase_ids = result[ERROR]
old_testcase_name = None
if failed_testcase_ids or errored_testcase_ids:
if failed_testcase_ids:
for failed_test_id in failed_testcase_ids:
new_testcase_name, test_name = \
result.get_testcase_names(failed_test_id)
@ -656,15 +656,16 @@ class AllResults(dict):
old_testcase_name = new_testcase_name
print(' FAILURE: {} [{}]'.format(
colorize(test_name, RED), failed_test_id))
for failed_test_id in errored_testcase_ids:
if errored_testcase_ids:
for errored_test_id in errored_testcase_ids:
new_testcase_name, test_name = \
result.get_testcase_names(failed_test_id)
result.get_testcase_names(errored_test_id)
if new_testcase_name != old_testcase_name:
print(' Testcase name: {}'.format(
colorize(new_testcase_name, RED)))
old_testcase_name = new_testcase_name
print(' ERROR: {} [{}]'.format(
colorize(test_name, RED), failed_test_id))
colorize(test_name, RED), errored_test_id))
if self.testsuites_no_tests_run:
print('TESTCASES WHERE NO TESTS WERE SUCCESSFULLY EXECUTED:')
tc_classes = set()