mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
add init-templatedir --no-allow-missing-config
Add a `--no-allow-missing-config` option to the `init-templatedir` command. Enable configuration of a Git template that requires newly cloned repos to have a `pre-commit` config.
This commit is contained in:
parent
0e851bdf75
commit
1b435f1f1f
4 changed files with 83 additions and 2 deletions
|
|
@ -159,7 +159,28 @@ def test_try_repo(mock_store_dir):
|
|||
def test_init_templatedir(mock_store_dir):
|
||||
with mock.patch.object(main, 'init_templatedir') as patch:
|
||||
main.main(('init-templatedir', 'tdir'))
|
||||
|
||||
assert patch.call_count == 1
|
||||
assert 'tdir' in patch.call_args[0]
|
||||
assert patch.call_args[1]['hook_types'] == ['pre-commit']
|
||||
assert patch.call_args[1]['skip_on_missing_config'] is True
|
||||
|
||||
|
||||
def test_init_templatedir_options(mock_store_dir):
|
||||
args = (
|
||||
'init-templatedir',
|
||||
'tdir',
|
||||
'--hook-type',
|
||||
'commit-msg',
|
||||
'--no-allow-missing-config',
|
||||
)
|
||||
with mock.patch.object(main, 'init_templatedir') as patch:
|
||||
main.main(args)
|
||||
|
||||
assert patch.call_count == 1
|
||||
assert 'tdir' in patch.call_args[0]
|
||||
assert patch.call_args[1]['hook_types'] == ['commit-msg']
|
||||
assert patch.call_args[1]['skip_on_missing_config'] is False
|
||||
|
||||
|
||||
def test_help_cmd_in_empty_directory(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue