'Called when an error has occurred. \'err\' is a tuple of values as
returned by sys.exc_info().'

def addError(self, test, err):

    import pywintypes
    exc_val = err[1]
    if (isinstance(exc_val, pywintypes.error) and (exc_val.winerror in non_admin_error_codes) and (not check_is_admin())):
        exc_val = TestSkipped(exc_val)
    elif (isinstance(exc_val, pywintypes.com_error) and (exc_val.hresult == winerror.CO_E_CLASSSTRING)):
        exc_val = TestSkipped(exc_val)
    elif isinstance(exc_val, NotImplementedError):
        exc_val = TestSkipped(NotImplementedError)
    if isinstance(exc_val, TestSkipped):
        reason = exc_val.args[0]
        try:
            reason = tuple(reason.args)
        except (AttributeError, TypeError):
            pass
        self.skips.setdefault(reason, 0)
        self.skips[reason] += 1
        if self.showAll:
            self.stream.writeln(('SKIP    (%s)' % (reason,)))
        elif self.dots:
            self.stream.write('S')
            self.stream.flush()
        return
    super(TestResult, self).addError(test, err)
