Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e1429ec

Browse files
committed
Add regression test for running multiple hooks with the same id.
1 parent 62f13ae commit e1429ec

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

tests/commands/run_test.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import unicode_literals
22

3+
import io
34
import mock
45
import os
56
import os.path
@@ -205,7 +206,22 @@ def test_hook_id_not_in_non_verbose_output(
205206

206207

207208
def test_hook_id_in_verbose_output(
208-
repo_with_passing_hook, mock_out_store_directory
209+
repo_with_passing_hook, mock_out_store_directory,
209210
):
210211
ret, printed = _do_run(repo_with_passing_hook, _get_opts(verbose=True))
211212
assert '[bash_hook] Bash hook' in printed
213+
214+
215+
def test_multiple_hooks_same_id(
216+
repo_with_passing_hook, mock_out_store_directory,
217+
):
218+
with local.cwd(repo_with_passing_hook):
219+
# Add bash hook on there again
220+
with io.open('.pre-commit-config.yaml', 'a+') as config_file:
221+
config_file.write(' - id: bash_hook\n')
222+
local['git']('add', '.pre-commit-config.yaml')
223+
stage_a_file()
224+
225+
ret, output = _do_run(repo_with_passing_hook, _get_opts())
226+
assert ret == 0
227+
assert output.count('Bash hook') == 2

0 commit comments

Comments
 (0)