Ejemplo n.º 1
0
 def startTest(self, test):
     # we want to change the ResultProxy object, not just the result,
     #  therefore we do it here, not in prepareTestResult
     rp = test.test._resultForDoCleanups
     # we store the original func
     rp._ml_add_success = rp.addSuccess
     # and replace it
     rp.addSuccess = make_instancemethod(_MemleakResult.addSuccess, rp)
     # also add a default failure flag
     rp._ml_is_success = False
     # Finally, we store with the test the names that it has at birth,
     #  so that we only wipe stuff created during the test.
     test._mda_pretest_attrs = test.test.__dict__.keys()
Ejemplo n.º 2
0
 def startTest(self, test):
     # we want to change the ResultProxy object, not just the result,
     #  therefore we do it here, not in prepareTestResult
     rp = test.test._resultForDoCleanups
     # we store the original func
     rp._ml_add_success = rp.addSuccess
     # and replace it
     rp.addSuccess = make_instancemethod(_MemleakResult.addSuccess, rp)
     # also add a default failure flag
     rp._ml_is_success = False
     # Finally, we store with the test the names that it has at birth,
     #  so that we only wipe stuff created during the test.
     test._mda_pretest_attrs = test.test.__dict__.keys()
Ejemplo n.º 3
0
def add_skip_patch(result):
    """Create a new addSkip method to patch into a result instance
    that delegates to addError.
    """
    return make_instancemethod(TextTestResult.addSkip, result)
Ejemplo n.º 4
0
def wassuccessful_patch(result):
    """Create a new wasSuccessful method that checks errorClasses for
    exceptions that were put into other slots than error or failure
    but that still count as not success.
    """
    return make_instancemethod(TextTestResult.wasSuccessful, result)
Ejemplo n.º 5
0
def print_label_patch(result):
    """Create a new printLabel method that prints errorClasses items
    as well.
    """
    return make_instancemethod(TextTestResult.printLabel, result)
Ejemplo n.º 6
0
def add_error_patch(result):
    """Create a new addError method to patch into a result instance
    that recognizes the errorClasses attribute and deals with
    errorclasses correctly.
    """
    return make_instancemethod(TextTestResult.addError, result)
Ejemplo n.º 7
0
def add_skip_patch(result):
    """Create a new addSkip method to patch into a result instance
    that delegates to addError.
    """
    return make_instancemethod(TextTestResult.addSkip, result)
Ejemplo n.º 8
0
def wassuccessful_patch(result):
    """Create a new wasSuccessful method that checks errorClasses for
    exceptions that were put into other slots than error or failure
    but that still count as not success.
    """
    return make_instancemethod(TextTestResult.wasSuccessful, result)
Ejemplo n.º 9
0
def print_label_patch(result):
    """Create a new printLabel method that prints errorClasses items
    as well.
    """
    return make_instancemethod(TextTestResult.printLabel, result)
Ejemplo n.º 10
0
def add_error_patch(result):
    """Create a new addError method to patch into a result instance
    that recognizes the errorClasses attribute and deals with
    errorclasses correctly.
    """
    return make_instancemethod(TextTestResult.addError, result)