Add language: fail

This commit is contained in:
Anthony Sottile 2018-08-10 18:11:28 -07:00
parent cf691e85c8
commit a6e2e1d4bb
3 changed files with 40 additions and 0 deletions

View file

@ -589,6 +589,29 @@ def test_local_rust_additional_dependencies(store):
assert _norm_out(ret[1]) == b"Hello World!\n"
def test_fail_hooks(store):
config = {
'repo': 'local',
'hooks': [{
'id': 'fail',
'name': 'fail',
'language': 'fail',
'entry': 'make sure to name changelogs as .rst!',
'files': r'changelog/.*(?<!\.rst)$',
}],
}
repo = Repository.create(config, store)
(_, hook), = repo.hooks
ret = repo.run_hook(hook, ('changelog/1234.bugfix', 'changelog/wat'))
assert ret[0] == 1
assert ret[1] == (
b'make sure to name changelogs as .rst!\n'
b'\n'
b'changelog/1234.bugfix\n'
b'changelog/wat\n'
)
def test_reinstall(tempdir_factory, store, log_info_mock):
path = make_repo(tempdir_factory, 'python_hooks_repo')
config = make_config_from_repo(path)