mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Make pre_commit also support pre-push hook
This commit is contained in:
parent
d2b11a0c50
commit
b707cbba06
10 changed files with 227 additions and 42 deletions
|
|
@ -7,6 +7,7 @@ import os.path
|
|||
import pre_commit.constants as C
|
||||
from pre_commit.runner import Runner
|
||||
from pre_commit.util import cwd
|
||||
from pre_commit.util import resource_filename
|
||||
from testing.fixtures import git_dir
|
||||
from testing.fixtures import make_consuming_repo
|
||||
|
||||
|
|
@ -58,6 +59,34 @@ def test_pre_commit_path():
|
|||
assert runner.pre_commit_path == expected_path
|
||||
|
||||
|
||||
def test_pre_push_path():
|
||||
runner = Runner('foo/bar')
|
||||
expected_path = os.path.join('foo/bar', '.git/hooks/pre-push')
|
||||
assert runner.pre_push_path == expected_path
|
||||
|
||||
|
||||
def test_pre_commit_legacy_path():
|
||||
runner = Runner('foo/bar')
|
||||
expected_path = os.path.join('foo/bar', '.git/hooks/pre-commit.legacy')
|
||||
assert runner.pre_commit_legacy_path == expected_path
|
||||
|
||||
|
||||
def test_pre_push_legacy_path():
|
||||
runner = Runner('foo/bar')
|
||||
expected_path = os.path.join('foo/bar', '.git/hooks/pre-push.legacy')
|
||||
assert runner.pre_push_legacy_path == expected_path
|
||||
|
||||
|
||||
def test_pre_template():
|
||||
runner = Runner('foo/bar')
|
||||
assert runner.pre_template == resource_filename('hook-tmpl')
|
||||
|
||||
|
||||
def test_pre_push_template():
|
||||
runner = Runner('foo/bar')
|
||||
assert runner.pre_push_template == resource_filename('pre-push-tmpl')
|
||||
|
||||
|
||||
def test_cmd_runner(mock_out_store_directory):
|
||||
runner = Runner('foo/bar')
|
||||
ret = runner.cmd_runner
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue