#NEWLINE# def run( self , test ) : #NEWLINE# #INDENT# 'Runs the given test case or test suite.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# self . _patch_standard_output ( ) #NEWLINE# result = self . _make_result ( ) #NEWLINE# self . stream . writeln ( ) #NEWLINE# self . stream . writeln ( 'Running tests...' ) #NEWLINE# self . stream . writeln ( result . separator2 ) #NEWLINE# start_time = time . time ( ) #NEWLINE# test ( result ) #NEWLINE# stop_time = time . time ( ) #NEWLINE# time_taken = ( stop_time - start_time ) #NEWLINE# result . printErrors ( ) #NEWLINE# self . stream . writeln ( result . separator2 ) #NEWLINE# run = result . testsRun #NEWLINE# self . stream . writeln ( ( 'Ran %d test%s in %.3fs' % ( run , ( ( ( run != 1 ) and 's' ) or '' ) , time_taken ) ) ) #NEWLINE# self . stream . writeln ( ) #NEWLINE# if ( not result . wasSuccessful ( ) ) : #NEWLINE# #INDENT# self . stream . write ( 'FAILED (' ) #NEWLINE# ( failed , errored ) = ( len ( result . failures ) , len ( result . errors ) ) #NEWLINE# if failed : #NEWLINE# #INDENT# self . stream . write ( ( 'failures=%d' % failed ) ) #NEWLINE# #UNINDENT# if errored : #NEWLINE# #INDENT# if failed : #NEWLINE# #INDENT# self . stream . write ( ', ' ) #NEWLINE# #UNINDENT# self . stream . write ( ( 'errors=%d' % errored ) ) #NEWLINE# #UNINDENT# self . stream . writeln ( ')' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . stream . writeln ( 'OK' ) #NEWLINE# #UNINDENT# self . stream . writeln ( ) #NEWLINE# self . stream . writeln ( 'Generating XML reports...' ) #NEWLINE# result . generate_reports ( self ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# pass #NEWLINE# self . _restore_standard_output ( ) #NEWLINE# #UNINDENT# return result