#NEWLINE# def _test_hook_repo( tempdir_factory , store , repo_path , hook_id , args , expected , expected_return_code = 0 , config_kwargs = None ) : #NEWLINE# #INDENT# path = make_repo ( tempdir_factory , repo_path ) #NEWLINE# config = make_config_from_repo ( path , ** ( config_kwargs or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# repo = Repository . create ( config , store ) #NEWLINE# hook_dict = [ hook for ( repo_hook_id , hook ) in repo . hooks if ( repo_hook_id == hook_id ) ] [ 0 ] #NEWLINE# ret = repo . run_hook ( hook_dict , args ) #NEWLINE# assert ( ret [ 0 ] == expected_return_code ) #NEWLINE# assert ( ret [ 1 ] . replace ( b'\r\n' , b'\n' ) == expected )