#NEWLINE# def test_error_logging( self ) : #NEWLINE# #INDENT# from django_extensions.management.base import logger #NEWLINE# logger . addHandler ( MockLoggingHandler ( ) ) #NEWLINE# module_path = 'django_extensions.tests.management.commands.error_raising_command' #NEWLINE# module = importlib . import_module ( module_path ) #NEWLINE# error_raising_command = module . Command ( ) #NEWLINE# self . assertRaises ( Exception , error_raising_command . execute ) #NEWLINE# handler = logger . handlers [ 0 ] #NEWLINE# self . assertEqual ( len ( handler . messages [ 'error' ] ) , 1 )