Commit 71ad5247 authored by Stefan Behnel's avatar Stefan Behnel

experimental XML output (requires unittest-xml-reporting package)

parent 36d1f095
...@@ -724,7 +724,9 @@ if __name__ == '__main__': ...@@ -724,7 +724,9 @@ if __name__ == '__main__':
help="display test progress, pass twice to print test names") help="display test progress, pass twice to print test names")
parser.add_option("-T", "--ticket", dest="tickets", parser.add_option("-T", "--ticket", dest="tickets",
action="append", 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() options, cmd_args = parser.parse_args()
...@@ -878,7 +880,20 @@ if __name__ == '__main__': ...@@ -878,7 +880,20 @@ if __name__ == '__main__':
os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'test'), os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3], 'test'),
'pyregr')) '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: if options.coverage:
coverage.stop() coverage.stop()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment