From 0386aa264388d64f0b70f991fc95a0bb27b21948 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 19 May 2015 13:36:03 -0500 Subject: [PATCH] Allow running against a single file --- ansible_testing/modules.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ansible_testing/modules.py b/ansible_testing/modules.py index ed2ed9e0c7d..12ac730059a 100644 --- a/ansible_testing/modules.py +++ b/ansible_testing/modules.py @@ -293,7 +293,7 @@ class PythonPackageValidator(Validator): def main(): parser = argparse.ArgumentParser() - parser.add_argument('modules', help='Path to modules') + parser.add_argument('modules', help='Path to module or module directory') parser.add_argument('-w', '--warnings', help='Show warnings', action='store_true') args = parser.parse_args() @@ -302,6 +302,13 @@ def main(): exit = [] + # Allow testing against a single file + if os.path.isfile(args.modules): + mv = ModuleValidator(os.path.abspath(args.modules)) + mv.validate() + exit.append(mv.report(args.warnings)) + sys.exit(sum(exit)) + for root, dirs, files in os.walk(args.modules): basedir = root[len(args.modules)+1:].split('/', 1)[0] if basedir in BLACKLIST_DIRS: