Пример #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()
Пример #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()
Пример #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)
Пример #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)
Пример #5
0
def print_label_patch(result):
    """Create a new printLabel method that prints errorClasses items
    as well.
    """
    return make_instancemethod(TextTestResult.printLabel, result)
Пример #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)
Пример #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)
Пример #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)
Пример #9
0
def print_label_patch(result):
    """Create a new printLabel method that prints errorClasses items
    as well.
    """
    return make_instancemethod(TextTestResult.printLabel, result)
Пример #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)