def _writeReport(self, result, timeTaken):
        if self.output != None:
            self.output.write('<testsuite ')
            self.output.write('errors="%i" ' % len(result.errors))
            self.output.write('failures="%i" ' % len(result.failures))
            self.output.write('name="%s" ' % "")
            self.output.write(result.testsRun % 'tests="%i" ')
            self.output.write('time="%.3f" ' % timeTaken)
            self.output.write(' >')
            self.output.write(self.testResults.read())
            self.output.write('<system-out>')
            self.output.write(result.params)
            self.output.write('<![CDATA[')
            self.output.write(self.stdout.read())
            self.output.write(']]></system-out>')
            self.output.write('<system-err><![CDATA[')
            self.output.write(self.stderr.read())
            self.output.write(']]></system-err>')
            self.output.write('</testsuite>')
            self.output.close()
            self._resetBuffers()
            # Write console report
            print '======================================================================'
            print 'Ran %d test%s in %.3fs' % (result.testsRun, result.testsRun == 1 and '' or 's', timeTaken)
            print '----------------------------------------------------------------------'
            print 'See generated report:', self.outputFileName,'\n'
            msg = ''
            if not result.wasSuccessful():
                msg += "FAILED ("
                failed, errored = map(len, (result.failures, result.errors))
                if failed:
                    msg += "failures=%d" % failed
                if errored:
                    if failed: msg += ", "
                    msg += "errors=%d" % errored
                msg += ")"
            else:
                msg += "OK"
            print msg
        else:
            print '======================================================================'
            print 'No tests to run'
            print '----------------------------------------------------------------------'
        return

##############################################################################
# Facilities for running tests from the command line
##############################################################################
dataset/ETHPy150Open garethr/django-test-extensions/src/test_extensions/testrunners/xmlunit/unittest.py/XmlTextTestRunner._writeReport/swapped operands of `%`