#NEWLINE# def test_setup_output( self ) : #NEWLINE# #INDENT# p = TestProgram ( 'name' ) #NEWLINE# if os . path . isfile ( p . data [ 'stdout' ] ) : #NEWLINE# #INDENT# os . unlink ( p . data [ 'stdout' ] ) #NEWLINE# #UNINDENT# with p . setup_output ( ) as ( out , err ) : #NEWLINE# #INDENT# check_call ( [ 'echo' , 'hello' ] , stdout = out , stderr = err ) #NEWLINE# #UNINDENT# with open ( p . data [ 'stdout' ] ) as fd : #NEWLINE# #INDENT# output = fd . read ( ) #NEWLINE# #UNINDENT# self . assertEqual ( output . strip ( ) , 'hello' ) #NEWLINE# with p . setup_output ( ) as ( out , err ) : #NEWLINE# #INDENT# check_call ( [ 'echo' , 'hello' ] , stdout = out , stderr = err ) #NEWLINE# #UNINDENT# with open ( p . data [ 'stdout' ] ) as fd : #NEWLINE# #INDENT# output = fd . read ( ) #NEWLINE# #UNINDENT# self . assertEqual ( output . split ( ) , [ 'hello' , 'hello' ] )