Commit 36f67c74 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeFunctionalTestCase: report unexpected success as failure

parent 3b7e99d0
...@@ -401,12 +401,13 @@ class FunctionalTestRunner: ...@@ -401,12 +401,13 @@ class FunctionalTestRunner:
else: else:
test_table = tr[1].xpath('.//table')[0] test_table = tr[1].xpath('.//table')[0]
status = tr.attrib.get('class') status = tr.attrib.get('class')
is_expected_failure = u"expected failure" in etree.tostring(test_table, encoding="unicode")
if 'status_failed' in status: if 'status_failed' in status:
# XXX replace status_failed classes by an inline style supported by gadget_html_viewer # XXX replace status_failed classes by an inline style supported by gadget_html_viewer
for test_tr in test_table.xpath('.//tr[contains(@class, "status_failed")]'): for test_tr in test_table.xpath('.//tr[contains(@class, "status_failed")]'):
test_tr.set('style', 'background-color: red;') test_tr.set('style', 'background-color: red;')
details_attribute_dict = {} details_attribute_dict = {}
if u"expected failure" in etree.tostring(test_table, encoding="unicode"): if is_expected_failure:
expected_failure_amount += 1 expected_failure_amount += 1
else: else:
failure_amount += 1 failure_amount += 1
...@@ -415,6 +416,10 @@ class FunctionalTestRunner: ...@@ -415,6 +416,10 @@ class FunctionalTestRunner:
detail_element = E.div() detail_element = E.div()
detail_element.append(E.details(E.summary(test_name), test_table, **details_attribute_dict)) detail_element.append(E.details(E.summary(test_name), test_table, **details_attribute_dict))
detail += unicode2str(etree.tostring(detail_element, encoding="unicode")) detail += unicode2str(etree.tostring(detail_element, encoding="unicode"))
elif is_expected_failure:
detail += 'Test {test_name} had unexpected success'.format(test_name=test_name)
error_title_list.append(test_name)
failure_amount += 1
tr_count += 1 tr_count += 1
success_amount = tr_count - 1 - failure_amount - expected_failure_amount success_amount = tr_count - 1 - failure_amount - expected_failure_amount
if detail: if detail:
......
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