mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-14 17:41:45 +04:00
make --hook-type and stages match
This commit is contained in:
parent
02e9680a46
commit
e3e17a1617
10 changed files with 147 additions and 42 deletions
|
|
@ -142,7 +142,7 @@ def test_check_args_length_prepare_commit_msg_error():
|
|||
def test_run_ns_pre_commit():
|
||||
ns = hook_impl._run_ns('pre-commit', True, (), b'')
|
||||
assert ns is not None
|
||||
assert ns.hook_stage == 'commit'
|
||||
assert ns.hook_stage == 'pre-commit'
|
||||
assert ns.color is True
|
||||
|
||||
|
||||
|
|
@ -245,7 +245,7 @@ def test_run_ns_pre_push_updating_branch(push_example):
|
|||
ns = hook_impl._run_ns('pre-push', False, args, stdin)
|
||||
|
||||
assert ns is not None
|
||||
assert ns.hook_stage == 'push'
|
||||
assert ns.hook_stage == 'pre-push'
|
||||
assert ns.color is False
|
||||
assert ns.remote_name == 'origin'
|
||||
assert ns.remote_url == src
|
||||
|
|
|
|||
|
|
@ -354,13 +354,13 @@ def test_show_diff_on_failure(
|
|||
({'hook': 'bash_hook'}, (b'Bash hook', b'Passed'), 0, True),
|
||||
(
|
||||
{'hook': 'nope'},
|
||||
(b'No hook with id `nope` in stage `commit`',),
|
||||
(b'No hook with id `nope` in stage `pre-commit`',),
|
||||
1,
|
||||
True,
|
||||
),
|
||||
(
|
||||
{'hook': 'nope', 'hook_stage': 'push'},
|
||||
(b'No hook with id `nope` in stage `push`',),
|
||||
{'hook': 'nope', 'hook_stage': 'pre-push'},
|
||||
(b'No hook with id `nope` in stage `pre-push`',),
|
||||
1,
|
||||
True,
|
||||
),
|
||||
|
|
@ -818,7 +818,7 @@ def test_stages(cap_out, store, repo_with_passing_hook):
|
|||
'language': 'pygrep',
|
||||
'stages': [stage],
|
||||
}
|
||||
for i, stage in enumerate(('commit', 'push', 'manual'), 1)
|
||||
for i, stage in enumerate(('pre-commit', 'pre-push', 'manual'), 1)
|
||||
],
|
||||
}
|
||||
add_config_to_repo(repo_with_passing_hook, config)
|
||||
|
|
@ -833,8 +833,8 @@ def test_stages(cap_out, store, repo_with_passing_hook):
|
|||
assert printed.count(b'hook ') == 1
|
||||
return printed
|
||||
|
||||
assert _run_for_stage('commit').startswith(b'hook 1...')
|
||||
assert _run_for_stage('push').startswith(b'hook 2...')
|
||||
assert _run_for_stage('pre-commit').startswith(b'hook 1...')
|
||||
assert _run_for_stage('pre-push').startswith(b'hook 2...')
|
||||
assert _run_for_stage('manual').startswith(b'hook 3...')
|
||||
|
||||
|
||||
|
|
@ -1173,7 +1173,7 @@ def test_args_hook_only(cap_out, store, repo_with_passing_hook):
|
|||
),
|
||||
'language': 'system',
|
||||
'files': r'\.py$',
|
||||
'stages': ['commit'],
|
||||
'stages': ['pre-commit'],
|
||||
},
|
||||
{
|
||||
'id': 'do_not_commit',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue