Esempio n. 1
0
File: cli.py Progetto: msabramo/spec
 def loadTestsFromTestClass(self, cls):
     """
     Manually examine test class for inner classes.
     """
     results = []
     for name, subclass in class_members(cls):
         results.extend(self.loader.loadTestsFromTestClass(subclass))
     return results
Esempio n. 2
0
File: cli.py Progetto: douglas/spec
 def loadTestsFromTestClass(self, cls):
     """
     Manually examine test class for inner classes.
     """
     results = []
     for name, subclass in class_members(cls):
         results.extend(self.loader.loadTestsFromTestClass(subclass))
     return results
Esempio n. 3
0
File: cli.py Progetto: douglas/spec
 def registerGoodClass(self, class_):
     """
     Internal bookkeeping to handle nested classes
     """
     # Class itself added to "good" list
     self._valid_classes.append(class_)
     # Recurse into any inner classes
     for name, cls in class_members(class_):
         if self.isValidClass(cls):
             self.registerGoodClass(cls)
Esempio n. 4
0
File: cli.py Progetto: msabramo/spec
 def registerGoodClass(self, class_):
     """
     Internal bookkeeping to handle nested classes
     """
     # Class itself added to "good" list
     self._valid_classes.append(class_)
     # Recurse into any inner classes
     for name, cls in class_members(class_):
         if self.isValidClass(cls):
             self.registerGoodClass(cls)
Esempio n. 5
0
def autohide(obj):
    """
    Automatically hide setup() and teardown() methods, recursively.
    """
    # Members on obj
    for name, item in six.iteritems(vars(obj)):
        if callable(item) and name in ('setup', 'teardown'):
            item = hide(item)
    # Recurse into class members
    for name, subclass in class_members(obj):
        autohide(subclass)
Esempio n. 6
0
def autohide(obj):
    """
    Automatically hide setup() and teardown() methods, recursively.
    """
    # Members on obj
    for name, item in six.iteritems(vars(obj)):
        if callable(item) and name in ('setup', 'teardown'):
            item = hide(item)
    # Recurse into class members
    for name, subclass in class_members(obj):
        autohide(subclass)
Esempio n. 7
0
def flag_inner_classes(obj):
    """
    Mutates any attributes on ``obj`` which are classes, with link to ``obj``.

    Adds a convenience accessor which instantiates ``obj`` and then calls its
    ``setup`` method.

    Recurses on those objects as well.
    """
    for tup in class_members(obj):
        tup[1]._parent = obj
        tup[1]._parent_inst = None
        tup[1].__getattr__ = my_getattr
        flag_inner_classes(tup[1])
Esempio n. 8
0
def flag_inner_classes(obj):
    """
    Mutates any attributes on ``obj`` which are classes, with link to ``obj``.

    Adds a convenience accessor which instantiates ``obj`` and then calls its
    ``setup`` method.

    Recurses on those objects as well.
    """
    for tup in class_members(obj):
        tup[1]._parent = obj
        tup[1]._parent_inst = None
        tup[1].__getattr__ = my_getattr
        flag_inner_classes(tup[1])