'Run the given test case or test suite.'

def run(self, test):

    result = self._make_result()
    self.stream.writeln()
    self.stream.writeln('Running    tests...')
    self.stream.writeln(result.separator2)
    start_time = time.time()
    test(result)
    stop_time = time.time()
    time_taken = (stop_time - start_time)
    self.stream.writeln()
    self.stream.writeln('Generating    XML    reports...')
    result.generate_reports(self)
    result.printErrors()
    self.stream.writeln(result.separator2)
    run = result.testsRun
    self.stream.writeln(('Ran    %d    test%s    in    %.3fs' % (run, (((run != 1) and 's') or ''), time_taken)))
    self.stream.writeln()
    if (not result.wasSuccessful()):
        self.stream.write('FAILED    (')
        (failed, errored) = (len(result.failures), len(result.errors))
        if failed:
            self.stream.write(('failures=%d' % failed))
        if errored:
            if failed:
                self.stream.write(',    ')
            self.stream.write(('errors=%d' % errored))
        self.stream.writeln(')')
    else:
        self.stream.writeln('OK')
    return result
