Add support for meta hooks

This commit is contained in:
Paul Hooijenga 2017-10-22 16:40:19 +02:00
parent 39d5205e31
commit 88c676a7c1
6 changed files with 130 additions and 1 deletions

View file

@ -709,6 +709,18 @@ def test_hook_id_not_present(tempdir_factory, store, fake_log_handler):
)
def test_meta_hook_not_present(store, fake_log_handler):
config = {'repo': 'meta', 'hooks': [{'id': 'i-dont-exist'}]}
repo = Repository.create(config, store)
with pytest.raises(SystemExit):
repo.require_installed()
assert fake_log_handler.handle.call_args[0][0].msg == (
'`i-dont-exist` is not a valid meta hook. '
'Typo? Perhaps it is introduced in a newer version? '
'Often `pre-commit autoupdate` fixes this.'
)
def test_too_new_version(tempdir_factory, store, fake_log_handler):
path = make_repo(tempdir_factory, 'script_hooks_repo')
with modify_manifest(path) as manifest: