def print_summary(junit_results, runner_name='ROSUNIT'):
 buff = StringIO()
 buff.write(((('[%s]' % runner_name) + ('-' * 71)) + '\n\n'))
 for tc_result in junit_results.test_case_results:
  buff.write(tc_result.description)
 buff.write('\nSUMMARY\n')
 if ((junit_results.num_errors + junit_results.num_failures) == 0):
  buff.write('\x1b[32m * RESULT: SUCCESS\x1b[0m\n')
 else:
  buff.write('\x1b[1;31m * RESULT: FAIL\x1b[0m\n')
 buff.write((' * TESTS: %s\n' % junit_results.num_tests))
 num_errors = junit_results.num_errors
 if num_errors:
  buff.write(('\x1b[1;31m * ERRORS: %s\x1b[0m\n' % num_errors))
 else:
  buff.write(' * ERRORS: 0\n')
 num_failures = junit_results.num_failures
 if num_failures:
  buff.write(('\x1b[1;31m * FAILURES: %s\x1b[0m\n' % num_failures))
 else:
  buff.write(' * FAILURES: 0\n')
 print(buff.getvalue())

def print_summary ( junit_results , runner_name = 'ROSUNIT' ) : buff = StringIO ( ) buff . write ( ( ( ( '[%s]' % runner_name ) + ( '-' * 71 ) ) + '\n\n' ) ) for tc_result in junit_results . test_case_results : buff . write ( tc_result . description ) buff . write ( '\nSUMMARY\n' ) if ( ( junit_results . num_errors + junit_results . num_failures ) == 0 ) : buff . write ( '\x1b[32m * RESULT: SUCCESS\x1b[0m\n' ) else : buff . write ( '\x1b[1;31m * RESULT: FAIL\x1b[0m\n' ) buff . write ( ( ' * TESTS: %s\n' % junit_results . num_tests ) ) num_errors = junit_results . num_errors if num_errors : buff . write ( ( '\x1b[1;31m * ERRORS: %s\x1b[0m\n' % num_errors ) ) else : buff . write ( ' * ERRORS: 0\n' ) num_failures = junit_results . num_failures if num_failures : buff . write ( ( '\x1b[1;31m * FAILURES: %s\x1b[0m\n' % num_failures ) ) else : buff . write ( ' * FAILURES: 0\n' ) print ( buff . getvalue ( ) )
print summary of junitxml results to stdout .