]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
porting teuthology-coverage to docopt
authorAndrew Schoen <aschoen@redhat.com>
Thu, 13 Nov 2014 20:33:32 +0000 (14:33 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 13 Nov 2014 20:33:51 +0000 (14:33 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
scripts/coverage.py

index 3aef9f5374e8d69f32ceb7c621ded17f53779f0d..51be6b50ddc83a7ae8eee88fcbe5e196f255eb68 100644 (file)
@@ -1,44 +1,29 @@
-import argparse
+"""
+usage: teuthology-coverage [-h] -o LCOV_OUTPUT [--html-output HTML_OUTPUT]
+                           [--cov-tools-dir COV_TOOLS_DIR] [--skip-init] [-v]
+                           <test_dir>
 
-import teuthology.coverage
+Analyze the coverage of a suite of test runs, generating html output with
+lcov.
 
+options:
+  -h, --help            show this help message and exit
+  -o LCOV_OUTPUT, --lcov-output LCOV_OUTPUT
+                        the directory in which to store results
+  --html-output HTML_OUTPUT
+                        the directory in which to store html output
+  --cov-tools-dir COV_TOOLS_DIR
+                        the location of coverage scripts (cov-init and cov-
+                        analyze) [default: ../../coverage]
+  --skip-init           skip initialization (useful if a run stopped partway
+                        through)
+  -v, --verbose         be more verbose
+"""
+import docopt
 
-def main():
-    teuthology.coverage.main(parse_args())
+import teuthology.coverage
 
 
-def parse_args():
-    parser = argparse.ArgumentParser(description="""
-Analyze the coverage of a suite of test runs, generating html output with lcov.
-""")
-    parser.add_argument(
-        '-o', '--lcov-output',
-        help='the directory in which to store results',
-        required=True,
-    )
-    parser.add_argument(
-        '--html-output',
-        help='the directory in which to store html output',
-    )
-    parser.add_argument(
-        '--cov-tools-dir',
-        help='the location of coverage scripts (cov-init and cov-analyze)',
-        default='../../coverage',
-    )
-    parser.add_argument(
-        '--skip-init',
-        help='skip initialization (useful if a run stopped partway through)',
-        action='store_true',
-        default=False,
-    )
-    parser.add_argument(
-        '-v', '--verbose',
-        help='be more verbose',
-        action='store_true',
-        default=False,
-    )
-    parser.add_argument(
-        'test_dir',
-        help='the location of the test results',
-    )
-    return parser.parse_args()
+def main():
+    args = docopt.docopt(__doc__)
+    teuthology.coverage.main(args)