Add an install-hooks command (similar to install --install-hooks). Resolves #456

This commit is contained in:
Anthony Sottile 2017-01-04 07:52:16 -08:00
parent 8837cfa7ff
commit f238495d6b
4 changed files with 51 additions and 10 deletions

View file

@ -13,6 +13,7 @@ import mock
import pre_commit.constants as C
from pre_commit.commands.install_uninstall import IDENTIFYING_HASH
from pre_commit.commands.install_uninstall import install
from pre_commit.commands.install_uninstall import install_hooks
from pre_commit.commands.install_uninstall import is_our_pre_commit
from pre_commit.commands.install_uninstall import is_previous_pre_commit
from pre_commit.commands.install_uninstall import PREVIOUS_IDENTIFYING_HASHES
@ -460,6 +461,20 @@ def test_installs_hooks_with_hooks_True(
assert PRE_INSTALLED.match(output)
def test_install_hooks_command(tempdir_factory, mock_out_store_directory):
path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
with cwd(path):
runner = Runner(path, C.CONFIG_FILE)
install(runner)
install_hooks(runner)
ret, output = _get_commit_output(
tempdir_factory, pre_commit_home=mock_out_store_directory,
)
assert ret == 0
assert PRE_INSTALLED.match(output)
def test_installed_from_venv(tempdir_factory):
path = make_consuming_repo(tempdir_factory, 'script_hooks_repo')
with cwd(path):