Module Expr Str ImportFrom alias ImportFrom alias ImportFrom alias Import alias Import alias Import alias ImportFrom alias FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore NameStore NameStore TupleStore NameStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad TryFinally body If CompareEq NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr keyword NameLoad keyword Str orelse Raise Call NameLoad Call AttributeLoad Str attr NameLoad finalbody Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list ClassDef bases AttributeLoad NameLoad attr body FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr Dict Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Pass Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr ListLoad Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str If BoolOpAnd Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call NameLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body TryExcept body If BoolOpAnd CompareEq AttributeLoad AttributeLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr attr attr Str CompareEq AttributeLoad AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr attr Str CompareEq AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Str body Assign NameStore AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index Num attr Assign NameStore AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num attr Assign NameStore AttributeLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Num attr If CompareIsNot AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr ListLoad attr TupleLoad NameLoad NameLoad NameLoad orelse Raise Call NameLoad Str handlers ExceptHandler type NameLoad body Return decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Return SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body ImportFrom alias Assign NameStore Str Expr Call NameLoad Call NameLoad NameLoad
N/A N/A 
Perform static analysis of test case code modules to determine parameters used by the test.
This should simplify maintenance by further automating the test case managment.
 __future__ absolute_import __future__ print_function __future__ division N/A sys N/A imp N/A ast pycopia module get_ast N/A N/A modname N/A N/A N/A Return an AST given a module path name. N/A N/A fo path N/A suffix mode mtype N/A N/A module find_module modname N/A N/A N/A N/A mtype N/A imp PY_SOURCE N/A N/A tree N/A N/A ast parse N/A N/A fo read filename path mode exec N/A N/A N/A ValueError N/A N/A {!r} is not a python source code module. format modname N/A N/A N/A N/A fo close N/A tree N/A TestmoduleVisitor N/A N/A ast NodeVisitor N/A __init__ N/A N/A self findall N/A True N/A N/A N/A self _classes N/A N/A N/A self _currentclass None N/A N/A self findall findall N/A visit_ClassDef N/A N/A self node N/A N/A N/A N/A N/A self findall N/A N/A N/A N/A self _currentclass N/A node name N/A N/A N/A self _classes N/A N/A node name N/A N/A N/A N/A self generic_visit node N/A visit_Assign N/A N/A self node N/A N/A N/A Looking for 'p1 = self.config.get("param1", "default1")'

        This is the canonical form of getting test case parameters in a test
        implementation. This ends up with an AST looking like:

            Assign(targets=[Name(id='p1', ctx=Store())],
            value=Call(func=Attribute(value=Attribute(value=Name(id='self',
            ctx=Load()), attr='config', ctx=Load()), attr='get', ctx=Load()),
            args=[Str(s='param1'), Str(s='default1')], keywords=[], starargs=None, kwargs=None))
         N/A N/A N/A isinstance N/A node value N/A ast Call N/A isinstance N/A N/A node value func N/A ast Attribute N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A node value func value value id self N/A N/A N/A N/A N/A node value func value attr config N/A N/A N/A N/A node value func attr get N/A N/A lhs N/A N/A N/A node targets N/A 0 id N/A param N/A N/A N/A N/A node value args N/A 0 s N/A default N/A N/A N/A N/A node value args N/A 1 s N/A N/A N/A self _currentclass None N/A N/A N/A N/A N/A N/A N/A self _classes setdefault N/A self _currentclass N/A append N/A lhs param default N/A N/A N/A ValueError Didn't see class before config get N/A N/A N/A AttributeError N/A N/A N/A N/A find_classes N/A N/A modname findall N/A True N/A N/A ast N/A get_ast modname N/A nv N/A TestmoduleVisitor findall N/A N/A N/A nv visit ast N/A N/A nv _classes N/A get_class N/A N/A cls N/A N/A N/A Return  TestModuleVisitor report from a class instance. N/A ast N/A get_ast N/A cls __module__ N/A nv N/A TestmoduleVisitor N/A N/A N/A nv visit ast N/A N/A N/A nv _classes N/A N/A cls __name__ N/A N/A N/A __name__ __main__ N/A pycopia autodebug N/A modname testcases.unittests.QA.core.params N/A N/A print N/A find_classes modname