From 63b595ec2c5ac8b1812ce4c1dd9ce9122cedc826 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Thu, 3 Apr 2014 22:22:00 -0700 Subject: [PATCH] check_yaml should not require any arguments. --- pre_commit_hooks/check_yaml.py | 2 +- tests/meta_test.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/meta_test.py diff --git a/pre_commit_hooks/check_yaml.py b/pre_commit_hooks/check_yaml.py index 210c6d6..c297ccf 100644 --- a/pre_commit_hooks/check_yaml.py +++ b/pre_commit_hooks/check_yaml.py @@ -9,7 +9,7 @@ from pre_commit_hooks.util import entry @entry def check_yaml(argv): parser = argparse.ArgumentParser() - parser.add_argument('filenames', nargs='+', help='Filenames to check.') + parser.add_argument('filenames', nargs='*', help='Filenames to check.') args = parser.parse_args(argv) retval = 0 diff --git a/tests/meta_test.py b/tests/meta_test.py new file mode 100644 index 0000000..773bb0d --- /dev/null +++ b/tests/meta_test.py @@ -0,0 +1,12 @@ + +import subprocess + +from pre_commit.clientlib.validate_manifest import load_manifest + + +def test_all_hooks_allow_no_files(): + manifest = load_manifest('hooks.yaml') + + for hook in manifest: + if hook['id'] != 'pyflakes': + subprocess.check_call([hook['entry']])