From 8e8b9622660f3cac7bece0c1007bf3604de0103d Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Sun, 14 Oct 2018 14:59:36 -0700 Subject: [PATCH] Improve coverage of check_hooks_apply --- tests/meta_hooks/check_hooks_apply_test.py | 54 +++++++++------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/tests/meta_hooks/check_hooks_apply_test.py b/tests/meta_hooks/check_hooks_apply_test.py index c75b036a..d48d9d7a 100644 --- a/tests/meta_hooks/check_hooks_apply_test.py +++ b/tests/meta_hooks/check_hooks_apply_test.py @@ -106,15 +106,34 @@ def test_hook_types_excludes_everything( assert 'check-useless-excludes does not apply to this repository' in out -def test_valid_always_run(capsys, tempdir_factory, mock_store_dir): +def test_valid_exceptions(capsys, tempdir_factory, mock_store_dir): config = { 'repos': [ { - 'repo': 'meta', + 'repo': 'local', 'hooks': [ + # applies to a file + { + 'id': 'check-yaml', + 'name': 'check yaml', + 'entry': './check-yaml', + 'language': 'script', + 'files': r'\.yaml$', + }, + # Should not be reported as an error due to language: fail + { + 'id': 'changelogs-rst', + 'name': 'changelogs must be rst', + 'entry': 'changelog filenames must end in .rst', + 'language': 'fail', + 'files': r'changelog/.*(?