mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Handle when the hooks directory is not there on install. Resolves #234.
This commit is contained in:
parent
b4bc5e4742
commit
a97cb38b9a
2 changed files with 13 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ import io
|
|||
import os
|
||||
import os.path
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
|
@ -78,6 +79,15 @@ def test_install_pre_commit(tmpdir_factory):
|
|||
assert pre_push_contents == expected_contents
|
||||
|
||||
|
||||
def test_install_hooks_directory_not_present(tmpdir_factory):
|
||||
path = git_dir(tmpdir_factory)
|
||||
# Simulate some git clients which don't make .git/hooks #234
|
||||
shutil.rmtree(os.path.join(path, '.git', 'hooks'))
|
||||
runner = Runner(path)
|
||||
install(runner)
|
||||
assert os.path.exists(runner.pre_commit_path)
|
||||
|
||||
|
||||
def test_uninstall_does_not_blow_up_when_not_there(tmpdir_factory):
|
||||
path = git_dir(tmpdir_factory)
|
||||
runner = Runner(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue