#NEWLINE# def test_error_displayed_when_chdir_fails( errstream ) : #NEWLINE# #INDENT# chdir = mock . Mock ( ) #NEWLINE# chdir . side_effect = OSError ( 'FAILED' ) #NEWLINE# handler = app . ChangeDirHandler ( err = errstream , chdir = errstream ) #NEWLINE# handler . run ( [ '.cd' , 'foo' ] , None ) #NEWLINE# assert ( 'FAILED' in errstream . getvalue ( ) )