summaryrefslogtreecommitdiffstats
path: root/tests/clientlib_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:23:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:23:44 +0000
commit8b9f67e46f462980dd0877e752954a07bfecdb32 (patch)
tree7455f28cae7a78fdec431903475978bbff39f984 /tests/clientlib_test.py
parentAdding upstream version 2.14.0. (diff)
downloadpre-commit-8b9f67e46f462980dd0877e752954a07bfecdb32.tar.xz
pre-commit-8b9f67e46f462980dd0877e752954a07bfecdb32.zip
Adding upstream version 2.15.0.upstream/2.15.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/clientlib_test.py')
-rw-r--r--tests/clientlib_test.py11
1 files changed, 11 insertions, 0 deletions
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',
(