@@ -57,6 +57,7 @@ def test_install_pre_commit(tempdir_factory):
5757 sys_executable = sys .executable ,
5858 hook_type = 'pre-commit' ,
5959 hook_specific = '' ,
60+ config_file = runner .config_file ,
6061 skip_on_missing_conf = 'false' ,
6162 )
6263 assert pre_commit_contents == expected_contents
@@ -72,6 +73,7 @@ def test_install_pre_commit(tempdir_factory):
7273 sys_executable = sys .executable ,
7374 hook_type = 'pre-push' ,
7475 hook_specific = pre_push_template_contents ,
76+ config_file = runner .config_file ,
7577 skip_on_missing_conf = 'false' ,
7678 )
7779 assert pre_push_contents == expected_contents
@@ -160,6 +162,18 @@ def test_install_pre_commit_and_run(tempdir_factory):
160162 assert NORMAL_PRE_COMMIT_RUN .match (output )
161163
162164
165+ def test_install_pre_commit_and_run_custom_path (tempdir_factory ):
166+ path = make_consuming_repo (tempdir_factory , 'script_hooks_repo' )
167+ with cwd (path ):
168+ cmd_output ('git' , 'mv' , C .CONFIG_FILE , 'custom-config.yaml' )
169+ cmd_output ('git' , 'commit' , '-m' , 'move pre-commit config' )
170+ assert install (Runner (path , 'custom-config.yaml' )) == 0
171+
172+ ret , output = _get_commit_output (tempdir_factory )
173+ assert ret == 0
174+ assert NORMAL_PRE_COMMIT_RUN .match (output )
175+
176+
163177def test_install_in_submodule_and_run (tempdir_factory ):
164178 src_path = make_consuming_repo (tempdir_factory , 'script_hooks_repo' )
165179 parent_path = git_dir (tempdir_factory )
0 commit comments