1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 08:56:13 +01:00

Generate JUnit-compatible XML test result reports if 'xmlrunner' is available.

This commit is contained in:
Sascha Peilicke 2011-09-08 11:42:45 +02:00
parent 6d1372c6f8
commit ca9e38c3d9
2 changed files with 14 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
*.swp
tags
build
tests/junit-xml-results

View File

@ -1,5 +1,13 @@
import os.path
import sys
import unittest
try:
import xmlrunner # JUnit like XML reporting
have_xmlrunner = True
except ImportError:
have_xmlrunner = False
import test_update
import test_addfiles
import test_deletefiles
@ -28,5 +36,9 @@ suite.addTests(test_package_status.suite())
suite.addTests(test_project_status.suite())
suite.addTests(test_request.suite())
suite.addTests(test_setlinkrev.suite())
if have_xmlrunner:
result = xmlrunner.XMLTestRunner(output=os.path.join(os.getcwd(), 'junit-xml-results')).run(suite)
else:
result = unittest.TextTestRunner(verbosity=1).run(suite)
sys.exit(not result.wasSuccessful())