summaryrefslogtreecommitdiffstats
path: root/tests/clientlib_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-27 16:04:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-27 16:04:26 +0000
commit7ad3acc8faa151e307c82b659f884205ef47012b (patch)
treeda74df356ea350b3ee9fb0bf71937e0bdb7896a6 /tests/clientlib_test.py
parentReleasing debian version 2.8.2-1. (diff)
downloadpre-commit-7ad3acc8faa151e307c82b659f884205ef47012b.tar.xz
pre-commit-7ad3acc8faa151e307c82b659f884205ef47012b.zip
Merging upstream version 2.9.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/clientlib_test.py')
-rw-r--r--tests/clientlib_test.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/clientlib_test.py b/tests/clientlib_test.py
index 2e2f738..bfb754b 100644
--- a/tests/clientlib_test.py
+++ b/tests/clientlib_test.py
@@ -166,6 +166,23 @@ def test_validate_warn_on_unknown_keys_at_top_level(tmpdir, caplog):
]
+def test_validate_optional_sensible_regex(caplog):
+ config_obj = {
+ 'id': 'flake8',
+ 'files': 'dir/*.py',
+ }
+ cfgv.validate(config_obj, CONFIG_HOOK_DICT)
+
+ assert caplog.record_tuples == [
+ (
+ 'pre_commit',
+ logging.WARNING,
+ "The 'files' field in hook 'flake8' is a regex, not a glob -- "
+ "matching '/*' probably isn't what you want here",
+ ),
+ ]
+
+
@pytest.mark.parametrize('fn', (validate_config_main, validate_manifest_main))
def test_mains_not_ok(tmpdir, fn):
not_yaml = tmpdir.join('f.notyaml')