| 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 inspect | 5 import inspect |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 | 8 |
| 9 from collections import namedtuple | 9 from collections import namedtuple |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 """ | 181 """ |
| 182 breakpoints = breakpoints or [] | 182 breakpoints = breakpoints or [] |
| 183 if not breakpoints or break_funcs: | 183 if not breakpoints or break_funcs: |
| 184 for f in (break_funcs or (func_call.func,)): | 184 for f in (break_funcs or (func_call.func,)): |
| 185 if hasattr(f, 'im_func'): | 185 if hasattr(f, 'im_func'): |
| 186 f = f.im_func | 186 f = f.im_func |
| 187 breakpoints.append((f.func_code.co_filename, | 187 breakpoints.append((f.func_code.co_filename, |
| 188 f.func_code.co_firstlineno, | 188 f.func_code.co_firstlineno, |
| 189 f.func_code.co_name)) | 189 f.func_code.co_name)) |
| 190 | 190 |
| 191 expect_dir = expect_dir.rstrip('/') | 191 if expect_dir: |
| 192 expect_dir = expect_dir.rstrip('/') |
| 192 return super(Test, cls).__new__(cls, name, func_call, expect_dir, | 193 return super(Test, cls).__new__(cls, name, func_call, expect_dir, |
| 193 expect_base, ext, covers, breakpoints) | 194 expect_base, ext, covers, breakpoints) |
| 194 | 195 |
| 195 | 196 |
| 196 @staticmethod | 197 @staticmethod |
| 197 def covers_obj(obj): | 198 def covers_obj(obj): |
| 198 test_file = inspect.getabsfile(obj) | 199 test_file = inspect.getabsfile(obj) |
| 199 covers = [test_file] | 200 covers = [test_file] |
| 200 match = Test.TEST_COVERS_MATCH.match(test_file) | 201 match = Test.TEST_COVERS_MATCH.match(test_file) |
| 201 if match: | 202 if match: |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 print 'UNHANDLED:', obj | 425 print 'UNHANDLED:', obj |
| 425 return Failure() | 426 return Failure() |
| 426 | 427 |
| 427 def finalize(self, aborted): | 428 def finalize(self, aborted): |
| 428 """Called after __call__() has been called for all results. | 429 """Called after __call__() has been called for all results. |
| 429 | 430 |
| 430 @param aborted: True if the user aborted the run. | 431 @param aborted: True if the user aborted the run. |
| 431 @type aborted: bool | 432 @type aborted: bool |
| 432 """ | 433 """ |
| 433 pass | 434 pass |
| OLD | NEW |