| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import argparse | 5 import argparse |
| 6 import logging | 6 import logging |
| 7 import multiprocessing | 7 import multiprocessing |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 sp.add_argument( | 57 sp.add_argument( |
| 58 '--force-coverage', '--force_coverage', action='store_true', | 58 '--force-coverage', '--force_coverage', action='store_true', |
| 59 help='Enable coverage report even when specifying a test filter.') | 59 help='Enable coverage report even when specifying a test filter.') |
| 60 | 60 |
| 61 sp.add_argument( | 61 sp.add_argument( |
| 62 '--test-list', '--test_list', metavar='FILE', | 62 '--test-list', '--test_list', metavar='FILE', |
| 63 help='take the list of test globs from the FILE (use "-" for stdin)' | 63 help='take the list of test globs from the FILE (use "-" for stdin)' |
| 64 ).completer = lambda **_: [] | 64 ).completer = lambda **_: [] |
| 65 | 65 |
| 66 sp.add_argument( | 66 sp.add_argument( |
| 67 '--package', metavar='PATH', action='append', default=[], | |
| 68 help='path to a Python package.') | |
| 69 | |
| 70 sp.add_argument( | |
| 71 '--directory', metavar='PATH', action='append', default=[], | |
| 72 help='directory containing Python packages to test.') | |
| 73 | |
| 74 sp.add_argument( | |
| 75 '--html-report', '--html_report', metavar='DIR', | 67 '--html-report', '--html_report', metavar='DIR', |
| 76 help='directory to write html report (default: disabled)' | 68 help='directory to write html report (default: disabled)' |
| 77 ).completer = lambda **_: [] | 69 ).completer = lambda **_: [] |
| 78 | 70 |
| 79 sp.add_argument( | 71 sp.add_argument( |
| 80 'test_glob', nargs='*', help=( | 72 'test_glob', nargs='*', help=( |
| 81 'glob to filter the tests acted on. If the glob begins with "-" ' | 73 'paths to look for tests in. It can be a directory containing ' |
| 82 'then it acts as a negation glob and anything which matches it ' | 74 'packages, a package, a file inside a package or a test inside a ' |
| 83 'will be skipped. If a glob doesn\'t have "*" in it, "*" will be ' | 75 'file (append the name of the test to the path using a colon)') |
| 84 'implicitly appended to the end') | |
| 85 ) | 76 ) |
| 86 | 77 |
| 87 opts = parser.parse_args(args) | 78 opts = parser.parse_args(args) |
| 88 | 79 |
| 89 if not hasattr(opts, 'jobs'): | 80 if not hasattr(opts, 'jobs'): |
| 90 opts.jobs = 0 | 81 opts.jobs = 0 |
| 91 elif opts.jobs < 1: | 82 elif opts.jobs < 1: |
| 92 parser.error('--jobs was less than 1') | 83 parser.error('--jobs was less than 1') |
| 93 | 84 |
| 94 if opts.test_list: | 85 if opts.test_list: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 cover_ctx.cleanup() | 147 cover_ctx.cleanup() |
| 157 if (not killed and | 148 if (not killed and |
| 158 (not opts.test_glob or | 149 (not opts.test_glob or |
| 159 opts.coverage)): | 150 opts.coverage)): |
| 160 if not cover_ctx.report(opts.verbose): | 151 if not cover_ctx.report(opts.verbose): |
| 161 sys.exit(2) | 152 sys.exit(2) |
| 162 | 153 |
| 163 sys.exit(error or killed) | 154 sys.exit(error or killed) |
| 164 except KeyboardInterrupt: | 155 except KeyboardInterrupt: |
| 165 pass | 156 pass |
| OLD | NEW |