17
by Jonathan Lange
LICENSE it as MIT. |
1 |
# Copyright (c) 2007-2010 testdoc authors. See LICENSE for details.
|
2 |
||
8
by jml@canonical.com
Move the last logic out of __init__ |
3 |
import inspect |
4 |
||
5 |
from testdoc import reflect |
|
6 |
||
7 |
||
8 |
def get_lineno(obj): |
|
9 |
return inspect.getsourcelines(obj)[1] |
|
10 |
||
11 |
||
12 |
def find_tests(finder, module): |
|
13 |
finder.got_module(module) |
|
14 |
classes = sorted(reflect.findTestClasses(module), key=get_lineno) |
|
15 |
for testCaseClass in classes: |
|
14.2.1
by Andrew Bennetts
Filter test cases imported from other modules. |
16 |
if testCaseClass.__module__ != module.__name__: |
17 |
continue
|
|
8
by jml@canonical.com
Move the last logic out of __init__ |
18 |
finder.got_test_class(testCaseClass) |
19 |
methods = [getattr(testCaseClass, 'test%s' % name) |
|
20 |
for name in reflect.getTestCaseNames(testCaseClass)] |
|
21 |
for method in sorted(methods, key=get_lineno): |
|
22 |
finder.got_test(method) |