#NEWLINE# @ pytest . yield_fixture #NEWLINE# def fake_log_handler( ) : #NEWLINE# #INDENT# handler = mock . Mock ( level = logging . INFO ) #NEWLINE# logger = logging . getLogger ( 'pre_commit' ) #NEWLINE# logger . addHandler ( handler ) #NEWLINE# ( yield handler ) #NEWLINE# logger . removeHandler ( handler )