You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running xmlrunner through unittest.main() and passing exit=False, unittest will not set a result code, but sets self.result to the xmrunner result. Because xmlrunner does not return a result compatible with unittest.TestResult there is no good way to check if the run was ok. When checking unittest.result.wasSuccessful() you get "AttributeError: module 'unittest.result' has no attribute 'wasSuccessful'".
Example:
importioimportsysimportunittestimportxmlrunnerdefunittestProxy():
# run the tests storing results in memoryxmlBytes=io.StringIO()
xmlRunner=xmlrunner.XMLTestRunner(output=xmlBytes, outsuffix='')
unittest.main(testRunner=xmlRunner, failfast=False, buffer=False, catchbreak=False, exit=False)
#...processing xmlBytes here.....# store result in XML filewithopen(resultFileName, 'w') asresultFile:
resultFile.write(xmlBytes)
# get exit code from unittest run (broken atm)sys.exit(notunittest.result.wasSuccessful())
if__name__=='__main__':
unittestProxy()
If there's a good workaround please let me know.
The text was updated successfully, but these errors were encountered:
When running xmlrunner through
unittest.main()
and passingexit=False
, unittest will not set a result code, but setsself.result
to the xmrunner result. Because xmlrunner does not return a result compatible with unittest.TestResult there is no good way to check if the run was ok. When checkingunittest.result.wasSuccessful()
you get "AttributeError: module 'unittest.result' has no attribute 'wasSuccessful'".Example:
If there's a good workaround please let me know.
The text was updated successfully, but these errors were encountered: