Add fail_fast support per-hook

This commit is contained in:
Stojan Nedic 2021-10-19 22:17:42 +02:00 committed by Anthony Sottile
parent ae53a8eb65
commit 63ae399db0
5 changed files with 16 additions and 1 deletions

View file

@ -985,6 +985,18 @@ def test_fail_fast(cap_out, store, repo_with_failing_hook):
assert printed.count(b'Failing hook') == 1
def test_fail_fast_per_hook(cap_out, store, repo_with_failing_hook):
with modify_config() as config:
# More than one hook
config['repos'][0]['hooks'] *= 2
config['repos'][0]['hooks'][0]['fail_fast'] = True
stage_a_file()
ret, printed = _do_run(cap_out, store, repo_with_failing_hook, run_opts())
# it should have only run one hook
assert printed.count(b'Failing hook') == 1
def test_classifier_removes_dne():
classifier = Classifier(('this_file_does_not_exist',))
assert classifier.filenames == []

View file

@ -1002,6 +1002,7 @@ def test_manifest_hooks(tempdir_factory, store):
types=['file'],
types_or=[],
verbose=False,
fail_fast=False,
)