'Record an expected failure from a test.
Some versions of subunit do not implement this. For those versions, we
record a success.'

def addExpectedFailure(self, test, failure, todo):

    failure = util.excInfoOrFailureToExcInfo(failure)
    addExpectedFailure = getattr(self._subunit, 'addExpectedFailure', None)
    if (addExpectedFailure is None):
        self.addSuccess(test)
    else:
        addExpectedFailure(test, failure)
