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 collections | 6 import collections |
7 import multiprocessing | 7 import multiprocessing |
8 import pkgutil | 8 import pkgutil |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 for _, modname, ispkg in pkgutil.walk_packages(path=['.']): | 152 for _, modname, ispkg in pkgutil.walk_packages(path=['.']): |
153 if any(modname.startswith(pkg) for pkg in blacklist): | 153 if any(modname.startswith(pkg) for pkg in blacklist): |
154 continue | 154 continue |
155 if ispkg: | 155 if ispkg: |
156 submods = getattr(load_module(modname), '__expect_tests_skip', None) | 156 submods = getattr(load_module(modname), '__expect_tests_skip', None) |
157 if isinstance(submods, collections.Iterable): | 157 if isinstance(submods, collections.Iterable): |
158 for submod in submods: | 158 for submod in submods: |
159 blacklist.add('.'.join([modname, submod])) | 159 blacklist.add('.'.join([modname, submod])) |
160 continue | 160 continue |
161 if modname.endswith('_test'): | 161 if modname.endswith('_test'): |
162 m = load_module(modname) | 162 ret.append(load_module(modname)) |
163 if m.__file__.endswith('.py'): | |
164 ret.append(m) | |
165 | 163 |
166 return ret | 164 return ret |
167 | 165 |
168 | 166 |
169 def get_test_gens(test_modules): | 167 def get_test_gens(test_modules): |
170 if test_modules is ALL_MODULES: | 168 if test_modules is ALL_MODULES: |
171 test_modules = find_all_modules() | 169 test_modules = find_all_modules() |
172 assert isinstance(test_modules, list) | 170 assert isinstance(test_modules, list) |
173 | 171 |
174 test_gens = [] | 172 test_gens = [] |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 cover_ctx.cleanup() | 222 cover_ctx.cleanup() |
225 if (not killed and | 223 if (not killed and |
226 not skip_loop and ( | 224 not skip_loop and ( |
227 opts.force_coverage or not opts.test_glob)): | 225 opts.force_coverage or not opts.test_glob)): |
228 if not cover_ctx.report(opts.verbose): | 226 if not cover_ctx.report(opts.verbose): |
229 sys.exit(2) | 227 sys.exit(2) |
230 | 228 |
231 sys.exit(error or killed) | 229 sys.exit(error or killed) |
232 except KeyboardInterrupt: | 230 except KeyboardInterrupt: |
233 pass | 231 pass |
OLD | NEW |