#NEWLINE# @ patch . object ( checker . Checker , 'report' ) #NEWLINE# def test_plugins( m_report ) : #NEWLINE# #INDENT# ' Plugins should be invoked by their "check" method\n    ' #NEWLINE# tree = compile ( textwrap . dedent ( '' ) , '<test>' , 'exec' , PyCF_ONLY_AST ) #NEWLINE# m_report . return_value = None #NEWLINE# m_check = MagicMock ( name = 'check' , return_value = [ ( MagicMock ( ) , None , ( ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ] ) #NEWLINE# m_checker = MagicMock ( name = 'checker' , check = m_check ) #NEWLINE# m_load = MagicMock ( name = 'load' , return_value = m_checker ) #NEWLINE# m_plugin = MagicMock ( name = 'plugin' , load = m_load ) #NEWLINE# with patch . object ( pkg_resources , 'iter_entry_points' , return_value = [ m_plugin ] ) as mock_ep : #NEWLINE# #INDENT# checker . Checker ( m_load , '' ) #NEWLINE# #UNINDENT# assert m_check . assert_called ( ) #NEWLINE# assert m_report . assert_called ( )