From: Stefan Behnel Date: Fri, 5 Mar 2010 08:56:16 +0000 (+0100) Subject: experimental XML output (requires unittest-xml-reporting package) X-Git-Tag: 0.13.beta0~2^2~102^2~14 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=71ad52474f60f38d1795626b8c88e80103822119;p=cython.git experimental XML output (requires unittest-xml-reporting package) --- diff --git a/runtests.py b/runtests.py index bdfad13f..f5958f7e 100644 --- a/runtests.py +++ b/runtests.py @@ -724,7 +724,9 @@ if __name__ == '__main__': help="display test progress, pass twice to print test names") parser.add_option("-T", "--ticket", dest="tickets", action="append", - help="a bug ticket number to run the respective test in 'tests/bugs'") + help="a bug ticket number to run the respective test in 'tests/*'") + parser.add_option("--xml-output", dest="xml_output_dir", metavar="DIR", + help="write test results in XML to directory DIR") options, cmd_args = parser.parse_args() @@ -878,7 +880,20 @@ if __name__ == '__main__': os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'test'), 'pyregr')) - result = unittest.TextTestRunner(verbosity=options.verbosity).run(test_suite) + if xml_output_dir: + try: + from xmlrunner import XMLTestRunner + except ImportError: + sys.stderr.write( + "Failed to import xmlrunner.XMLTestRunner, no XML output available\n") + xml_output_dir = None + + if xml_output_dir: + test_runner = XMLTestRunner(output=xml_output_dir) + else: + test_runner = unittest.TextTestRunner(verbosity=options.verbosity) + + result = test_runner.run(test_suite) if options.coverage: coverage.stop()