Commit 552dfbcc authored by Rafael Monnerat's avatar Rafael Monnerat

tests: make _updateFunctionalTestResponse compatible with py3

parent 902d44d6
...@@ -110,20 +110,21 @@ class SlapOSCloud(SavedTestSuite, ProjectTestSuite): ...@@ -110,20 +110,21 @@ class SlapOSCloud(SavedTestSuite, ProjectTestSuite):
def _updateFunctionalTestResponse(self, status_dict): def _updateFunctionalTestResponse(self, status_dict):
""" Convert the Unit Test output into more accurate information """ Convert the Unit Test output into more accurate information
related to funcional test run. related to functional test run.
""" """
# Parse relevant information to update response information # Parse relevant information to update response information
try: try:
summary, html_test_result = status_dict['stderr'].split("-"*79)[1:3] summary, html_test_result = status_dict['stderr'].split(b"-"*79)[1:3]
except ValueError: except ValueError:
# In case of error when parse the file, preserve the original # In case of error when parse the file, preserve the original
# informations. This prevents we have unfinished tests. # information. This prevents we have unfinished tests.
return status_dict return status_dict
status_dict['html_test_result'] = html_test_result status_dict['html_test_result'] = html_test_result
search = self.FTEST_PASS_FAIL_RE.search(summary) search = self.FTEST_PASS_FAIL_RE.search(summary.decode())
if search: if search:
group_dict = search.groupdict() group_dict = search.groupdict()
status_dict['failure_count'] = int(group_dict['failures']) status_dict['failure_count'] = int(group_dict['failures']) \
or int(status_dict.get('failure_count', 0))
status_dict['test_count'] = int(group_dict['total']) status_dict['test_count'] = int(group_dict['total'])
status_dict['skip_count'] = int(group_dict['expected_failure']) status_dict['skip_count'] = int(group_dict['expected_failure'])
return status_dict return status_dict
......
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