From 8b9f67e46f462980dd0877e752954a07bfecdb32 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 Sep 2021 06:23:44 +0200 Subject: Adding upstream version 2.15.0. Signed-off-by: Daniel Baumann --- tests/clientlib_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/clientlib_test.py') diff --git a/tests/clientlib_test.py b/tests/clientlib_test.py index 09bdb3e..da794e6 100644 --- a/tests/clientlib_test.py +++ b/tests/clientlib_test.py @@ -1,4 +1,5 @@ import logging +import re import cfgv import pytest @@ -10,6 +11,7 @@ from pre_commit.clientlib import CONFIG_REPO_DICT from pre_commit.clientlib import CONFIG_SCHEMA from pre_commit.clientlib import DEFAULT_LANGUAGE_VERSION from pre_commit.clientlib import MANIFEST_SCHEMA +from pre_commit.clientlib import META_HOOK_DICT from pre_commit.clientlib import MigrateShaToRev from pre_commit.clientlib import validate_config_main from pre_commit.clientlib import validate_manifest_main @@ -392,6 +394,15 @@ def test_meta_hook_invalid(config_repo): cfgv.validate(config_repo, CONFIG_REPO_DICT) +def test_meta_check_hooks_apply_only_at_top_level(): + cfg = {'id': 'check-hooks-apply'} + cfg = cfgv.apply_defaults(cfg, META_HOOK_DICT) + + files_re = re.compile(cfg['files']) + assert files_re.search('.pre-commit-config.yaml') + assert not files_re.search('foo/.pre-commit-config.yaml') + + @pytest.mark.parametrize( 'mapping', ( -- cgit v1.2.3