def print_unittest_summary(result):
 buff = StringIO()
 buff.write('-------------------------------------------------------------\nSUMMARY:\n')
 if result.wasSuccessful():
  buff.write('\x1b[32m * RESULT: SUCCESS\x1b[0m\n')
 else:
  buff.write(' * RESULT: FAIL\n')
 buff.write((' * TESTS: %s\n' % result.testsRun))
 buff.write((' * ERRORS: %s [%s]\n' % (len(result.errors), ', '.join(_format_errors(result.errors)))))
 buff.write((' * FAILURES: %s [%s]\n' % (len(result.failures), ', '.join(_format_errors(result.failures)))))
 print(buff.getvalue())

def print_unittest_summary ( result ) : buff = StringIO ( ) buff . write ( '-------------------------------------------------------------\nSUMMARY:\n' ) if result . wasSuccessful ( ) : buff . write ( '\x1b[32m * RESULT: SUCCESS\x1b[0m\n' ) else : buff . write ( ' * RESULT: FAIL\n' ) buff . write ( ( ' * TESTS: %s\n' % result . testsRun ) ) buff . write ( ( ' * ERRORS: %s [%s]\n' % ( len ( result . errors ) , ', ' . join ( _format_errors ( result . errors ) ) ) ) ) buff . write ( ( ' * FAILURES: %s [%s]\n' % ( len ( result . failures ) , ', ' . join ( _format_errors ( result . failures ) ) ) ) ) print ( buff . getvalue ( ) )
print summary of python unittest result to stdout .