#NEWLINE# def main( ) : #NEWLINE# #INDENT# args = parse_args ( ) #NEWLINE# stream = subunit . ByteStreamToStreamResult ( sys . stdin , non_subunit_name = 'stdout' ) #NEWLINE# starts = Starts ( sys . stdout ) #NEWLINE# outcomes = testtools . StreamToDict ( functools . partial ( show_outcome , sys . stdout , print_failures = args . print_failures , failonly = args . failonly ) ) #NEWLINE# summary = testtools . StreamSummary ( ) #NEWLINE# result = testtools . CopyStreamResult ( [ starts , outcomes , summary ] ) #NEWLINE# result . startTestRun ( ) #NEWLINE# try : #NEWLINE# #INDENT# stream . run ( result ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# result . stopTestRun ( ) #NEWLINE# #UNINDENT# if ( count_tests ( 'status' , '.*' ) == 0 ) : #NEWLINE# #INDENT# print ( "The test run didn't actually run any tests" ) #NEWLINE# return 1 #NEWLINE# #UNINDENT# if args . post_fails : #NEWLINE# #INDENT# print_fails ( sys . stdout ) #NEWLINE# #UNINDENT# print_summary ( sys . stdout ) #NEWLINE# return ( 0 if summary . wasSuccessful ( ) else 1 )