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:
parent
6d1372c6f8
commit
ca9e38c3d9
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
*.swp
|
||||
tags
|
||||
build
|
||||
tests/junit-xml-results
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user