8
by jml@canonical.com
Move the last logic out of __init__ |
1 |
import inspect |
2 |
||
3 |
from testdoc import reflect |
|
4 |
||
5 |
||
6 |
def get_lineno(obj): |
|
7 |
return inspect.getsourcelines(obj)[1] |
|
8 |
||
9 |
||
10 |
def find_tests(finder, module): |
|
11 |
finder.got_module(module) |
|
12 |
classes = sorted(reflect.findTestClasses(module), key=get_lineno) |
|
13 |
for testCaseClass in classes: |
|
14 |
finder.got_test_class(testCaseClass) |
|
15 |
methods = [getattr(testCaseClass, 'test%s' % name) |
|
16 |
for name in reflect.getTestCaseNames(testCaseClass)] |
|
17 |
for method in sorted(methods, key=get_lineno): |
|
18 |
finder.got_test(method) |