From a971f38b11f5955f6ea4f7922233d8324a5c6753 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 27 Jan 2021 17:04:10 +0100 Subject: Adding upstream version 2.9.3. Signed-off-by: Daniel Baumann --- tests/clientlib_test.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/clientlib_test.py') 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') -- cgit v1.2.3