#NEWLINE# @ skip_if_windows ( 'Ctrl-C not valid on windows.' ) #NEWLINE# def test_can_handle_ctrl_c( self ) : #NEWLINE# #INDENT# class CtrlCRenderer ( FakePosixHelpRenderer ) : #NEWLINE# #INDENT# def _popen( self , * args , **kwargs ) : #NEWLINE# #INDENT# if self . _is_pager_call ( args ) : #NEWLINE# #INDENT# os . kill ( os . getpid ( ) , signal . SIGINT ) #NEWLINE# #UNINDENT# return self . mock_popen #NEWLINE# #UNINDENT# def _is_pager_call( self , args ) : #NEWLINE# #INDENT# return ( 'less' in args [ 0 ] ) #NEWLINE# #UNINDENT# #UNINDENT# renderer = CtrlCRenderer ( ) #NEWLINE# renderer . mock_popen . communicate . return_value = ( 'send to pager' , '' ) #NEWLINE# renderer . exists_on_path [ 'groff' ] = True #NEWLINE# renderer . render ( 'foo' ) #NEWLINE# last_call = renderer . mock_popen . communicate . call_args_list [ ( - 1 ) ] #NEWLINE# self . assertEqual ( renderer , mock . call ( input = 'send to pager' ) )