#NEWLINE# def test_merge_context_manager_failure( self ) : #NEWLINE# #INDENT# with mock . patch ( 'pushmanager.core.git.GitCommand' ) as GC : #NEWLINE# #INDENT# GC . return_value = GC #NEWLINE# GC . run . return_value = ( 0 , 'hashashash' , '' ) #NEWLINE# try : #NEWLINE# #INDENT# with pushmanager . core . git . git_merge_context_manager ( 'name_of_test_branch' , 'path_to_master_repo' ) : #NEWLINE# #INDENT# raise pushmanager . core . git . GitException ( 'We tried to merge and it broke!' ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# calls = [ mock . call ( 'rev-parse' , 'name_of_test_branch' , cwd = 'path_to_master_repo' ) , mock . call . run ( ) , mock . call ( 'reset' , '--hard' , 'hashashash' , cwd = 'path_to_master_repo' ) , mock . call . run ( ) ] #NEWLINE# GC . assert_has_calls ( self )