def run_tests(test_suite, xml_file): """ Run test suite and save output to junit xml file if requested. """ if xml_file: print 'Writting test results to: %s' % xml_file fp = open('report.xml', 'w') result = junitxml.JUnitXmlResult(fp) result.startTestRun() test_suite.run(result) result.stopTestRun() fp.close() else: unittest.TextTestRunner(verbosity=2).run(test_suite)
def run_tests(test_suite, xml_file): """ Run test suite and save output to junit xml file if requested. """ if xml_file: print 'Writting test results to: %s' % xml_file fp = open('report.xml', 'w') result = junitxml.JUnitXmlResult(fp) # Text from stdout/stderr should be added to failed test cases. result.buffer = True result.startTestRun() test_suite.run(result) result.stopTestRun() fp.close() else: unittest.TextTestRunner(verbosity=2).run(test_suite)